Name
xs:keyref — Definition of a key reference.
Synopsis
<xs:keyref id = xs:ID name = xs:NCName refer = xs:QName {any attributes with non-schema namespace} > Content: ((xs:annotation?), (xs:selector, xs:field+)) </xs:keyref>
May be included in: xs:element (within xs:all), xs:element (reference or local definition), xs:element (global definition)
Description
xs:keyref
is used to define a reference to a
simple or compound key or to a unique constraint.
The syntax of xs:keyref
is very similar to the
syntax of xs:key
or xs:unique
.
The only difference is the refer
attribute, which
must contain the name of the referred key or unique constraint.
The root element for the keyref
is the element in
which the key is defined. The key reference is often defined with the
same root element as its referred key or unique constraint, in which
case the matching is simple and straightforward.
The root element of the keyref
may also be defined
in any element for which it is in the scope of a matching constraint
node table, i.e., in all the ancestors of the root element of the
referred key or unique constraint. In this case, an additional check
is performed; for each matching key reference, the validator should
test that the key or unique value is defined only once in all the
matching key or unique root elements.
Restrictions
Key references defined in an ancestor of their referenced key or unique constraint actually add additional constraints on the referenced key or the unique key, which may be unexpected. ...
Get XML Schema now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.