XML Schema key 元素
定義和用法
key 元素指定屬性或元素值(或一組值)必須是指定範圍內的鍵。 鍵的範圍為實例文檔中的包含element。 鍵意味著數據在指定範圍內應是唯一的、不為零的並且始終存在的。
key 元素必須按順序包含下列元素:
- selector 元素包含一個XPath 表達式,該表達式指定一個元素集,在元素集中,field 指定的值必須是唯一的。
元素信息
- 父元素: element
語法
<key
id=ID
name=NCName
any attributes
>
(annotation?,(selector,field+))
</key>
id=ID
name=NCName
any attributes
>
(annotation?,(selector,field+))
</key>
(? 符號聲明在key 元素中,元素可出現零次或一次,+ 符號聲明元素必須出現一次或多次。)
属性 | 描述 |
---|---|
id | 可选。规定该元素的唯一的 ID。 |
name | 必需。规定 key 元素的名称。 |
any attributes | 可选。规定带有 non-schema 命名空间的任何其他属性。 |
完整XML Schema參考手冊