我正在尝试创建一个独特的元素。这是我的代码的一部分。
<complexType name="DeliveryOrder">
<sequence>
<element name="Depot" type="tns:County" minOccurs="1" maxOccurs="1"></element>
<element name="CustomerDetails" type="tns:CustomerDetails" minOccurs="1" maxOccurs="1"></element>
<element name="ItemsToBeDelivered"
type="tns:ItemsToBeDelivered" maxOccurs="unbounded" minOccurs="1">
</element>
</sequence>
</complexType>
<complexType name="CustomerDetails">
<sequence>
<element name="FirstName">
<simpleType>
<restriction base="string">
<pattern value="[a-zA-Z][a-z][a-z]*"></pattern>
</restriction>
</simpleType>
</element>
<element name="Surname">
<simpleType>
<restriction base="string">
<pattern value="[a-z{^}A-Z][a-z][a-z]*"></pattern>
</restriction>
</simpleType>
</element>
<element name="AddressLine1">
<simpleType>
<restriction base="string">
<minLength value="4"></minLength>
<whiteSpace value="collapse"></whiteSpace>
</restriction>
</simpleType>
</element>
<element name="AddressLine2">
<simpleType>
<restriction base="string">
<minLength value="4"></minLength>
<whiteSpace value="collapse"></whiteSpace>
</restriction>
</simpleType>
</element>
<element name="AddressLine3" type="string">
</element>
<element name="County" type="tns:County" maxOccurs="1" minOccurs="1"></element>
</sequence>
</complexType>
<complexType name="County">
<choice>
<element name="CountyName">
<simpleType>
<restriction base="string">
<enumeration value="Dublin"></enumeration>
<enumeration value="Cork"></enumeration>
<enumeration value="Kildare"></enumeration>
<enumeration value="Waterford"></enumeration>
<enumeration value="Wicklow"></enumeration>
</restriction>
</simpleType>
</element>
</choice>
</complexType>
<complexType name="DaysForDelivery">
<sequence>
<element name="Day">
<simpleType>
<restriction base="string">
<enumeration value="Monday"></enumeration>
<enumeration value="Tuesday"></enumeration>
<enumeration value="Wednesday"></enumeration>
<enumeration value="Thursday"></enumeration>
<enumeration value="Friday"></enumeration>
</restriction>
</simpleType>
</element>
</sequence>
</complexType>
<element name="DeliveryOrder" type="tns:DeliveryOrder"></element>
<complexType name="ItemsToBeDelivered">
<sequence>
<element name="DaysForDelivery" type="tns:DaysForDelivery"
maxOccurs="unbounded" minOccurs="1">
</element>
<element name="Item" type="tns:Item" maxOccurs="unbounded" minOccurs="1"></element>
</sequence>
</complexType>
<complexType name="Item">
<sequence>
<element name="Description">
<simpleType>
<restriction base="string">
<enumeration
value="Regular Milk - 1 litre carton.">
</enumeration>
<enumeration
value="Low Fat Milk - 1 litre carton.">
</enumeration>
<enumeration
value="Strawberry Yoghurt - 100ml pot">
</enumeration>
<enumeration
value="Raspberry Yoghurt - 100ml pot">
</enumeration>
<enumeration value="Cream - 125ml carton"></enumeration>
<enumeration value="Cream - 250ml carton"></enumeration>
</restriction>
</simpleType>
</element>
<element name="Quantity">
<simpleType>
<restriction base="int">
<minInclusive value="1"></minInclusive>
</restriction>
</simpleType>
</element>
</sequence>
</complexType>
所以,我希望“DaysForDelivery”中的“Day”元素是唯一的。例如:我可以在星期一拥有一个 X 项目,然后就不能再使用星期一了。我知道我必须使用独特的标签,我看了很多例子,但我把它弄乱了 xpaths。
先感谢您