我知道我已经多次发布了这个问题。但我现在遇到了一个新错误,我需要帮助。这是我收到的错误。“s4s-elt-invalid-content.1:‘#AnonType_orders’的内容无效。元素‘element’无效、错位或出现频率过高。”
这是我的 xsd 文件:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="reach">
<xs:restriction base = "xs:integer">
<xs:enumeration value = "50" />
<xs:enumeration value = "75" />
<xs:enumeration value = "100" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name = "language">
<xs:restriction base = "xs: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:simpleType name="caseColor">
<xs:restriction base="xs:string">
<xs:enumeration value="Lemonde" />
<xs:enumeration value="Strawberry" />
<xs:enumeration value="Lime" />
<xs:enumeration value="Blueberry" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="numOfBat">
<xs:restriction base="xs:integer">
<xs:enumeration value="1" />
<xs:enumeration value="2" />
<xs:enumeration value="3" />
<xs:enumeration value="4" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="numOfCam">
<xs:restriction base="xs:string">
<xs:pattern value="1|2" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="volt">
<xs:restriction base="xs:string">
<xs:enumeration value="110-120" />
<xs:enumeration value="220-240" />
</xs:restriction>
</xs:simpleType>
<xs:element name="orders">
<xs:complexType>
<xs:element name ="order" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="custName" type ="xs:string" />
<xs:attribute name ="custID" />
<xs:element name="case" type="xs:caseColor" >
</xs:element>
<xs:element name="batteries" type="xs:numOfBat" default =
"1">
</xs:element>
<xs:element name="recharger" type="xs:volt" />
<xs:element name="arm">
<xs:element name ="reaches" minOccurs="2" maxOccurs="3"
type="xs:reach" />
</xs:element>
<xs:element name ="camera" type="xs:numOfCam" />
<xs:element name = "speech" type="xs:language" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:complexType>
</xs:element>
</xs:schema>
这是我的 xml 文件:
<?xml version="1.0" encoding="UTF-8"?>
<orders>
<order>
<custName custID="11223"> John Doe </custName>
<case> Strawberry </case>
<batteries> 2 </batteries>
<recharger> 110-120 V </recharger>
<arm>
<reach> 50 </reach>
<reach> 100 </reach>
</arm>
<camera> 2 </camera>
<speech> Spanish </speech>
</order>
<order>
<custName custID="45392"> Jane Camp </custName>
<case> Lime </case>
<batteries> 4 </batteries>
<recharger> 220-240 V </recharger>
<arm> 3
<reach> 75 </reach>
<reach> 75 </reach>
<reach> 100 </reach>
</arm>
<camera> 1 </camera>
<speech> Chinese </speech>
</order>
<order>
<custName custID="69482"> George Carlton </custName>
<case> Blueberry </case>
<batteries> 1 </batteries>
<recharger> 110-120 V </recharger>
<arm>
<reach> 75 </reach>
<reach> 100 </reach>
</arm>
<camera> 2 </camera>
<speech> French </speech>
</order>
</orders>