Schema El Key
# XML Schema key Element
* * Complete XML Schema Reference Manual](#)
* * *
## Definition and Usage
The key element specifies that an attribute or element value (or set of values) must be a key within the specified scope. The scope of the key is the containing element in the instance document. A key means the data should be unique, non-null, 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 the field must be unique.
### Element Information
* **Parent Element:** element
### Syntax
(annotation?,(selector,field+))
(The ? symbol declares that the element may appear zero or one time within the key element, and the + symbol declares that the element must appear one or more times.)
| Attribute | 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 non-schema namespaces. |
* * Complete XML Schema Reference Manual](#)
YouTip