Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
<xsd:field> Element

<xsd:field> Element

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).

  id = ID 
  xpath = a subset of XPath expression 
  {any attributes with non-schema Namespace}...>
Content: (annotation?)



The ID of this element. The id value must be of type ID and be unique within the document containing this element.



An XPath expression that is relative to each element selected by the selector of the identity constraint. This expression must identify a single element or attribute whose content or value is used for the constraint. If the expression identifies an element, that element must be of a simple type.


Element Information

Number of occurrences

One time

Parent elements

key, keyref, unique




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 ':' '*'  



When using XPath, you must use fully qualified names if the name is defined with a non-empty targetNamespace. For example, myNS:localName instead of localName.


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"/>

Other Resources

For more information see the W3C XML Schema Part 1: Structures Recommendation.

See Also

© 2015 Microsoft