XML Schema keyref element

Definition and usage

The keyref element specifies that the attribute or element value (or a set of values) corresponds to the value of the specified key or unique element.

The keyref element must sequentially contain the following elements:

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 that specifies a 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

Appearance times One time
Parent element element
Content annotation, field, selector

Syntax

<keyref
id=ID
name=NCName
refer=QName
beliebige Attribute
>
(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.)

Attributes Description
id Optional. Specifies the unique ID of the element.
name Erforderlich. Definiert den Namen des key-Elements.
refer Erforderlich. Definiert den Namen der key oder unique Elemente, die im Schema (oder einem anderen Schema, das durch die angegebene Namensraumbezeichnung angezeigt wird) definiert sind. Der refer-Wert muss ein限定名 (QName) sein. Der Typ kann Namenspräfixe enthalten.
beliebige Attribute Optional. Definiert alle anderen Attribute mit non-schema Namensräumen.