XML Schema field element
Definition and usage
The field element specifies an XPath expression that identifies the value (or one of the values) used to define the identifier constraint (unique, key, and keyref elements).
Element information
Number of occurrences | Once |
Parent element | key, keyref, unique |
Content | annotation |
Syntax
<field id=ID xpath=XPath expression any attributes > (annotation?) </field>
Attribute | Description |
---|---|
id | Optional. Specifies the unique ID of the element. |
xpath | Must. Identifies a single element or attribute whose content or value is to be constrained. If the expression identifies an element, then the element must be of simple type. |
xml:lang | Optional. Specifies the language used in the content. |
(The '?' symbol is declared within the field element, which can appear zero or one time.)
Instance
Example 1
The following example demonstrates a field element that defines the 'userID' attribute as a field used to identify constraints:
<xs:field xpath="@userID"/>