我收到以下错误
<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.
我的调度器 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">
我把上面的都替换成了下面的
<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">
我的错误消失了。
这是怎么回事,谁能告诉我??
最佳答案
schemaLocation
属性引用命名空间的 XML 模式文档。
基本上在你输入时:
xmlns:expns="http://www.example.com"
xsi:schemaLocation="http://www.example.com
http://www.example.com/schema/example.xsd"
你是说:"我要使用前缀 expns
命名空间的元素 http://www.example.com
。此外,为了验证这些元素,请获取 http://www.example.com
的 XSD 架构文件 in 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"
等等。
这就是为什么它必须是一个偶数。
更多信息和示例可以找到 here .
关于java - 错误 : "schemaLocation value *** must have even number of URI' s. “在 Spring 调度程序中的命名空间上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16662953/