XML Schema keyref element
Definition and usage
The keyref element specifies the property or element value (or a set of values) corresponding to the value of the specified key or unique element.
The keyref element must contain the following elements in order:
Selector element:
There must be one and only one selector element.
The selector element contains an XPath expression that specifies an element set in which the value specified by field must be unique.
field element
There must be one or more field elements.
Each field element contains an XPath expression, which specifies the unique value (attribute or element value) for the element set specified by the selector element.
If there are multiple field elements, the combination of the field elements must be unique. In this case, the value of a single field element for the selected element may not be unique, but the combination of all fields must be unique.
Element information
Occurrence times | One |
Parent element | element |
Content | annotation, field, selector |
Syntax
<keyref id=ID name=NCName refer=QName any attributes > (annotation?,(selector,field+)) </include>
(The '?' symbol declares in the key element, the element can appear zero or one times, the '+' symbol declares the element must appear one or more times.)
Attribute | Description |
---|---|
id | Optional. Specifies the unique ID of the element. |
name | Required. Specifies the name of the key element. |
refer | Required. Specifies the name of the key or unique element defined in the schema (or any other schema indicated by the specified namespace). The refer value must be a qualified name (QName). The type can include namespace prefixes. |
any attributes | Optional. Specifies any other attributes with non-schema namespace. |