to the main page about the tutorial  THE XML REVOLUTION  -  TECHNOLOGIES FOR THE FUTURE WEB back up next

Identity constraints

XPath can be used to specify uniqueness requirements.

Example:

<unique name="uniqueness-requirement-87">
  <selector xpath=".//personlist"/>
  <field xpath="person/@ssn"/>
</unique>

occurring in an element declaration, means that: within each personlist, every ssn attribute of a person element must have a unique value.

Similarly, we can define keys (with key) and references (with keyref) which generalizes the ID/IDREF mechanism from DTD in a straightforward way.

Only a simple subset of XPath is allowed:

back COPYRIGHT © 2000-2003 ANDERS MØLLER & MICHAEL I. SCHWARTZBACH next