unique 元素指定屬性或元素值(或者屬性或元素值的組合)在指定范圍內必須是唯一的。 該值必須唯一或為零。
unique 元素必須按順序包含下列元素:
selector 元素包含 XPath 表達式,指定一個元素集,在其中由 field 元素指定的值必須唯一。
必須有一個且只有一個 selector 元素。
每一個 field 元素均包含一個 XPath 表達式,指定對于由 selector 元素指定的元素集而言必須唯一的值(屬性或元素值)。
如果有多個 field 元素,則 field 元素的組合必須是唯一的。 在此情況下,單個 field 元素的值對于選定元素不一定是唯一的,但所有字段的組合必須是唯一的。
必須有一個或多個 field 元素。
出現次數 | 一次 |
父元素 | element |
內容 | annotation、field、selector |
<unique id=ID name=NCName any attributes > (annotation?,(selector,field+)) </unique>
(? 符號聲明在 unique 元素中該元素可出現零次或一次。)
屬性 | 描述 |
---|---|
id | 可選。規定該元素的唯一的 ID。 |
name | 必需。為該元素指定名稱。 |
any attributes | 可選。規定帶有 non-Schema 命名空間的任何其他屬性。 |
本例是一個合并了兩個簡單類型的簡單類型:
<xs:element name="jeans_size"> <xs:simpleType> <xs:union memberTypes="sizebyno sizebystring" /> </xs:simpleType> </xs:element> <xs:simpleType name="sizebyno"> <xs:restriction base="xs:positiveInteger"> <xs:maxInclusive value="42"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="sizebystring"> <xs:restriction base="xs:string"> <xs:enumeration value="small"/> <xs:enumeration value="medium"/> <xs:enumeration value="large"/> </xs:restriction> </xs:simpleType>
如對本文有疑問,請提交到交流論壇,廣大熱心網友會為你解答??! 點擊進入論壇