Specifies an XML Path Language (XPath) expression that specifies the value (or one of the values) used to define an identity constraint (unique, key, and keyref elements).
<field id = ID xpath = a subset of XPath expression {any attributes with non-schema Namespace}…> Content: (annotation?) </field>
Optional.
Required.
Number of occurrences | One time |
Parent elements | key, keyref, unique |
Contents | annotation |
An identity constraint must contain one or more field elements and those field elements must appear after the selector element.
Selector ::= Path ( '|' Path )* FieldXPath ::= ('.//')? ( Step '/' )* ( Step | '@' NameTest ) Step ::= '.' | NameTest NameTest ::= QName | '*' | NCName ':' '*'
Note When using XPath, you must use fully qualified names if the name is defined with a non-empty targetNamespace. For example,myNS:localName
instead oflocalName
.
The following fragment is a field element that specifies the myID attribute as the field to use for the identity constraint.
<xs:field xpath="@myID"/>
XML Schema Reference (XSD) | XML Schema Elements
For more information, see the W3C XML Schema Part 1: Structures Recommendation at http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-field.