java - 无法验证 XML

标签 java spring maven apache-camel

我正在尝试在 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/

相关文章:

java - 如何在java中获取路径的长度?

security - 如何锁定 grails spring security/cas 应用程序?

maven - Maven pom.xml 中 "SNAPSHOT"版本的含义

java - Maven 在编译阶段连接文本文件

java - JTextfield,如何验证getText()方法中的内容

java - 如何正确使用Map.Entry接口(interface),为什么Map.Entry的方法已经实现了?

java - 二维条码检测和图像分割

java - 如何在运行时向 spring-boot 应用程序添加额外的 jar 文件?

java - 与 Jackson 的一对多 Json 响应不起作用

java - 是否必须安装 Ant 才能运行 Maven 的 maven-antrun-plugin?