错误:"schemaLocation值***必须具有偶数个URI." 在Spring调度程序中的命名空间

fee*_*ing 19 java xml xsd spring-mvc

我得到了以下错误

<Ignored XML validation warning> org.xml.sax.SAXParseException; lineNumber: 9; columnNumber: 55;
SchemaLocation: schemaLocation value = 'http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx' must have even number of URI's.
Run Code Online (Sandbox Code Playgroud)

我的调度程序servlet具有以下命名空间

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">  
Run Code Online (Sandbox Code Playgroud)

我通过以下方式取代了以上所有内容

<beans xmlns="http://www.springframework.org/schema/beans"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://www.springframework.org/schema/beans
              http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">  
Run Code Online (Sandbox Code Playgroud)

我的错误消失了.
怎么会发生任何一个人说?

acd*_*ior 60

schemaLocation属性引用名称空间的XML Schema文档.

基本上当你输入:

xmlns:expns="http://www.example.com"
xsi:schemaLocation="http://www.example.com
                    http://www.example.com/schema/example.xsd"
Run Code Online (Sandbox Code Playgroud)

你是在说:" 我将使用前缀 expns 的命名空间的元素 http://www.example.com同样,这样你就可以验证这些元素,让XSD架构文件. http://www.example.com http://www.example.com/schema/example.xsd "

换句话说,格式是:

xsi:schemaLocation="namespace-a   where_to_get_the_xsd_for_namespace-a
                    namespace-b   where_to_get_the_xsd_for_namespace-b
                    namespace-c   where_to_get_the_xsd_for_namespace-c"
Run Code Online (Sandbox Code Playgroud)

等等.

这就是为什么它必须是偶数.


可在此处找到更多信息和示例.