A key constraint is just like a uniqueness constraint.
Except the selector and field specified must exist.
The other big difference is that keys can be referred to within the document.
A key is required to make a reference can be validated.
It is specified by the 'key' element with:
a required 'name' attribute.
One 'selector' child.
One or more 'field' children.
A key declaration example:
<xs:key name="product-name"> <xs:selector xpath="."/> <xs:field xpath="name"/> </xs:key>