XML Schema key Element
Definition and Usage
The key element specifies that the 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 implies that 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
selectorelement contains an XPath expression that specifies a set of elements, within which the values specified byfieldmust be unique.
Element Information
- Parent Element:
element
Syntax
(? symbol declares that the element can appear zero or one time, + 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. |