XML Schema field element

Definition and Usage

The field element specifies an XPath expression, which specifies the value (or one of the values) used to define the identifier constraint (unique, key, and keyref elements).

element information

occurrence times once
parent element key, keyref, unique
content annotation

syntax

<field
id=ID 
xpath=XPath expression
any attributes
>
(annotation?)
</field>
Attribute Description
id Optional. Specifies a unique ID for the element.
xpath Required. Identifies a single element or attribute whose content or value is used for constraints. If the expression identifies an element, then the element must be of a 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 shows a field element that defines the "userID" attribute as a field used for identification constraints:

<xs:field xpath="@userID"/>