我在运行Spring Integration代码时收到以下XSD Valation错误:
demo-context.xml]无效;嵌套异常为org.xml.sax.SAXParseException:cos all limited。1.2:"all"模型组必须出现在"{'min occurs'}"="{'max occurs"}"=1的粒子中,并且该粒子必须是构成复杂类型定义的"{"content-type"}"的一对的一部分。
demo-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>
看起来你的模式验证器不喜欢这个模式——但这个模式对我来说还可以(更重要的是,它看起来还可以Saxon,在一些细节上比我更可靠)。
另一方面,Xerces和Saxon都同意您未命名的XSD验证器的观点,即您显示的文档是无效的;他们抱怨int:logging通道适配器元素上的expression属性,并表示不允许使用该名称的属性。