我正在尝试在 Spring Boot 中创建一条 Camel 路线。我收到以下错误。
由以下原因引起:org.xml.sax.SAXParseException:s4s-elt-character:除“xs:appinfo”和“xs:documentation”之外的架构元素中不允许使用非空白字符。看到“301 永久移动”。
我的 applicationContext.xml 看起来像这样。
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"
xmlns:cxf="http://cxf.apache.org/blueprint/core"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf"
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd
http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd"
default-activation="lazy">
<!-- CXF SERVER -->
<camelcxf:rsServer id="productRestController"
address="http://0.0.0.0:8080/product"
serviceClass="com.born.oktopus.product.controller.ProductRestController"
loggingFeatureEnabled="true" loggingSizeLimit="20" >
<!-- <cxf:schemaLocations> <value>classpath:/schemas/productDataList.xsd</value>
</cxf:schemaLocations> <camelcxf:providers> <ref component-id="jaxbProviderXsi"
/> </camelcxf:providers> -->
</camelcxf:rsServer>
<!-- ERP BEANS -->
<bean id="loggingOutInterceptor"
class="org.apache.cxf.interceptor.LoggingOutInterceptor" >
<property name="prettyLogging" value="true" />
</bean>
</blueprint>
最佳答案
听起来您正在尝试使用 XML 文件而不是 XSD 验证转换文件,因为 applicationContext.xml 显示正确。
您需要向我们展示您在何处使用 SAX 进行解析的 JAVA 代码,但我猜您要么有某种拼写错误,要么您认为自己正在解析 XSD 文件,但您引用了 XML 文件。
关于java - 无法验证 XML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55379544/