Spring集成:获取XSD验证错误:cos-all-limited.1.2

时间:2013-09-03 09:26:22

标签: spring integration xsd-validation

我在运行Spring Integrtion代码时遇到XSD Valdation错误:

demo-context.xml]无效;嵌套异常是org.xml.sax.SAXParseException:cos-all-restricted.1.2:''all''模型组必须出现在一个粒子中,'{'min occurrence'}'='{'max occurrence'}' = 1,该粒子必须是一对的一部分,它构成复杂类型定义的'{'内容类型'}'。

演示context.xml中:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
    xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
        http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd">

    <import resource="jdbc-context.xml" />

    <int:channel id="request" />
    <int:channel id="response" />

    <int:gateway id="demoService" service-interface="com.integration.DemoService" />

    <int-jdbc:outbound-gateway
        update="INSERT INTO Demo
                SELECT EID, BR from tab1, tab2
                WHERE tab1.BR=tab2.BR AND tab1.BR=:payload "

        request-channel="requestChannel" reply-channel="responseChannel"
        data-source="dataSource" />

    <int:logging-channel-adapter id="loggingChannel"
        channel="responseChannel" expression="'Inserted successfully'" />

</beans>

1 个答案:

答案 0 :(得分:1)

看起来您的架构验证器不喜欢架构 - 但架构看起来不错(更重要的是,它看起来很好Saxon,它比我在某些细节上更可靠)。

另一方面,Xerces和Saxon都同意您的未命名的XSD验证器,因为您显示的文档无效;他们抱怨int:logging-channel-adapter元素上的expression属性,并且说没有允许该名称的属性。