如果模式对同一个XSD有一个导入,则应该导入该XSD以防止出现“重复定义”错误。
例如: 我有三个模式:
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://www.springframework.org/schema/util/spring-util-4.2.xsd
http://www.springframework.org/schema/jee/spring-jee-4.2.xsd
现在我得到一个errror,因为弹簧UTIL和弹簧JEE有一个进口:
<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans-4.2.xsd"/>
<xsd:import namespace="http://www.springframework.org/schema/tool" schemaLocation="http://www.springframework.org/schema/tool/spring-tool-4.2.xsd"/>
春天-tool将手动导入在spring-util和spring-jee之前:
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://www.springframework.org/schema/tool/spring-tool-4.2.xsd
http://www.springframework.org/schema/util/spring-util-4.2.xsd
http://www.springframework.org/schema/jee/spring-jee-4.2.xsd
XML配置将被正确解析。
显然,你应该有合适的版本。
小的解决办法是在其他文件中定义配置的某些部分与描述不同的架构,并使用导入:
<import resource="part_of_config.xml"/>
这并没有为我工作:( – saikosen 2017-03-25 13:32:10