XML Schema key element

Definition and usage

The attribute or element value (or a set of values) specified by the key element must be a key within the specified range. The range of keys is the element contained in the instance document. A key means that the data within the specified range should be unique, non-zero, and always present.

The key 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 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 unrestricted
parent element element
content annotation, field, selector

grammar

<key
id=ID
name=NCName
κατανοητές αξίες
>
(annotation?,(selector,field+))
</key>

(? σύμβολο αναφέρει στο στοιχείο key, το στοιχείο μπορεί να εμφανίζεται μηδέν ή μια φορά, + σύμβολο αναφέρει στο στοιχείο που πρέπει να εμφανίζεται μια ή περισσότερες φορές.)

Αξίες Περιγραφή
id Επιλογή. Ορίζει το μοναδικό ID του στοιχείου.
όνομα Απαιτείται. Ορίζει το όνομα του στοιχείου key.
κατανοητές αξίες Επιλογή. Ορίζει οποιεσδήποτε άλλες αξίες με μη σχήματο όνομα χώρο.