【发布时间】:2016-04-19 14:21:25
【问题描述】:
我的 xml 架构和我的 xml 文档都是有效且格式正确的。但是正确的参考还是有问题的。我查了几个类似的问题,但我无法解决我的问题。
xml 架构的开始:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com">
<xs:element name="catalog"/>
xml 架构示例:
<xs:element name="Qstr">
<xs:complexType>
<xs:sequence>
<xs:element name="text" type="xs:string"/>
<xs:element name="a" type="xs:string"/>
<xs:element name="b" type="xs:string"/>
<xs:element name="c" type="xs:string"/>
<xs:element name="d" type="xs:string"/>
</xs:sequence>
</xs:complexType>
xml 文档的开头:
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com file:///home/n/workspace/webprog1/WebContent/schema.xml">
<Qstr>
<text>random question?</text>
<a>asdfasd</a>
<b>ertwetrewt</b>
<c>ghkghk</c>
<d>xcvbxcbbx</d>
</Qstr>
错误信息:
Invalid content was found starting with element '{"http://www.w3schools.com":text}'. One of '{text}' is expected.
【问题讨论】:
-
显示架构中讨论“文本”的部分。
标签: xml