XML Schema keyElement
Complete XML Schema Reference
Definition and Usage
The key element specifies that an attribute or element value (or a set of values) must be a key within a specified scope. The scope of the key is the containing element in the instance document. Key means that the data should be unique, non-zero, and always present within the specified scope.
The key element must contain the following elements in order:
- The selector element contains an XPath expression that specifies a set of elements, within which the values specified by field must be unique.
Element Information
- Parent element: element
Syntax
<key
id=ID
name=NCName
any attributes
>
(annotation?,(selector,field+))
</key>
id=ID
name=NCName
any attributes
>
(annotation?,(selector,field+))
</key>
(The ? sign declares that the element can appear zero or one time inside the key element, and the + sign declares that the element must appear one or more times.)
| Attributes | Description |
|---|---|
| id | Optional. Specifies a unique ID for the element. |
| name | Required. Specifies the name of the key element. |
| any attributes | Optional. Specifies any other attributes with a non-schema namespace. |
Complete XML Schema Reference Other extensions