我无法定义元素的内容类型(“电话号码”),同时定义具有枚举限制的属性(“位置”)。
这是我卡住的地方:
<xs:element name="phonenumbers">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="phonenumber">
<!--
Try #1:
Define the type of the attribute "location" and the
content-type of the element "phonenumber". But without
enumeration restrictions on "location".
-->
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attribute name="location" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<!--
Try #2:
Enumerables in attribute "location" with no content-type
of the element "phonenumber", thus being unable to put
anything in it.
-->
<xs:complexType>
<xs:attribute name="location">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Home"/>
<xs:enumeration value="Work"/>
<xs:enumeration value="Mobile"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>