1
我想弄清楚這個錯誤是什麼意思,當我在http://corefiling.com/opensource/schemaValidate.html使用驗證器。這是我從這個驗證器收到的錯誤。xml,xsd驗證問題
s4s-elt-must-match.1: The content of 'orders' must match (annotation?, (simpleType |
complexType)?, (unique | key | keyref)*)).
A problem was found starting at: element.
這是什麼錯誤信息我?
這裏是我的xsd文件
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="orders">
<xs:element name ="order" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="case" type="xs:caseColor" >
<xs:simpleType name="caseColor">
<xs:restriction base="string">
<xs:enumeration value="Lemonde" />
<xs:enumeration value="Strawberry" />
<xs:enumeration value="Lime" />
<xs:enumeration value="Blueberry" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="batteries" type="xs:numOfBat" default =
"1">
<xs:simpleType name="numOfBat">
<xs:restriction base="integer">
<xs:enumeration value="1" />
<xs:enumeration value="2" />
<xs:enumeration value="3" />
<xs:enumeration value="4" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="recharger" type="xs:volt">
<xs:simpleType name="volt">
<xs:restriction base="string">
<xs:enumeration value="110-120" />
<xs:enumeration value="220-240" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="arm">
<xs:element name ="reaches" minOccurs="2" maxOccurs="3"
type="xs:reach">
<xs:simpleType name="reach">
<xs:restriction base = "integer">
<xs:enumeration value = "50" />
<xs:enumeration value = "75" />
<xs:enumeration value = "100" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:element>
<xs:element name ="camera" type="numOfCam">
<xs:simpleType name="numOfCam">
<xs:restriction base="string">
<xs:enumeration value="1" />
<xs:enumeration value="2" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name = "speech" type="xs:language">
<xs:simpleType name = "language">
<xs:restriction base = "string">
<xs:enumeration value = "Spanish" />
<xs:enumeration value = "Chinese" />
<xs:enumeration value = "English" />
<xs:enumeration value = "German" />
<xs:enumeration value = "French" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:element>
</xs:schema>
這裏是我的xml文件
<?xml version="1.0" encoding="UTF-8"?>
<orders>
<order>
<case> Strawberry </case>
<batteries> 2 </batteries>
<recharger> 110-120 V </recharger>
<arm> 2
<length> 50 </length>
<length> 100 </length>
</arm>
<camera> 2 </camera>
<speech> Spanish </speech>
</order>
<order>
<case> Lime </case>
<batteries> 4 </batteries>
<recharger> 220-240 V </recharger>
<arm> 3
<length> 75 </length>
<length> 75 </length>
<length> 100 </length>
</arm>
<camera> 1 </camera>
<speech> Chinese </speech>
</order>
<order>
<case> Blueberry </case>
<batteries> 1 </batteries>
<recharger> 110-120 V </recharger>
<arm> 2
<length> 75 </length>
<length> 100 </length>
</arm>
<camera> 2 </camera>
<speech> French </speech>
</order>
</orders>
我試着驗證這個對我的XML文件,我收到了很多錯誤 – beginnerprogrammer 2012-04-09 05:07:53
與我的XML,我假設你的意思是由X你提供的ML!它沒有給我任何錯誤! – 2012-04-09 05:09:03
這怎麼可能?它應該工作!你使用了什麼驗證器(XML解析器)? – 2012-04-09 05:10:16