问题描述
我收到以下错误
<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 具有以下命名空间
and my dispatcher servlet was having following namespaces
<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">
我用以下内容替换了以上所有内容
and i replaced all above by following
<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">
我的错误消失了.
有没有人能说一下是怎么回事??
And my error got disappeared.
How it happened can any one tell??
推荐答案
schemaLocation
属性引用命名空间的 XML 架构文档.
The schemaLocation
attribute references an XML Schema document for a namespace.
基本上在您输入时:
xmlns:expns="http://www.example.com"
xsi:schemaLocation="http://www.example.com
http://www.example.com/schema/example.xsd"
你是说:"我将使用前缀 expns
作为命名空间的元素 http://www.example.com
.此外,为了验证这些元素,获取的 XSD 架构文件 http://www.example.com代码> in
http://www.example.com/schema/example.xsd
"
You are saying: "I'm going to use the prefix expns
for the elements of the namespace http://www.example.com
. Also, so you can validate those elements, get the XSD Schema file for http://www.example.com
in http://www.example.com/schema/example.xsd
"
所以,换句话说,格式是:
So, in other words, the format is:
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"
等等.
这就是为什么它必须是一个偶数.
That's why it must me an even number.
可以在此处找到更多信息和示例.
这篇关于错误:“schemaLocation 值 *** 必须具有偶数个 URI."关于 spring 调度程序中的命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!