Specifies an XML Path Language (XPath) expression that selects a set of elements for an identity constraint (unique, key, and keyref elements).
<selector
id = ID
xpath = a subset of XPath expression
{any attributes with non-schema Namespace}…>
Content: (annotation?)
</selector>
Optional.
Required.
| Number of occurrences | One time |
| Parent elements | key, keyref, unique |
| Contents | annotation |
Selector ::= Path ( '|' Path )*
Path ::= ('.//')? Step ( '/' Step )*
Step ::= '.' | NameTest
NameTest ::= QName | '*' | NCName ':' '*'
Note When using XPath, you must use fully qualified names. For example,myNS:localNameinstead oflocalName.
The following fragment is a selector element that selects all expense elements with a field element that selects an approved attribute.
<selector xpath=".//expense"/> <field xpath="@approved"/>
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-selector.