Home > Articles > Web Services > XML

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend


Each identity constraint identifies a set of nodes that must be unique or that require referential integrity. Each identity constraint has a specific scope, which is the enclosing element type; any element type may provide any number of identity constraints.

In the example schema, the following schema excerpt specifies a key relative to the element type idConstraintDemo:

<xsd:element name= "idConstraintDemo">

* * * *


* * * *

  <xsd:key name="partNumberKey">
      <xsd:documentation xml:lang="en">
        The part number uniquely identifies
        each orderable item.
    <xsd:selector xpath="catalog/*"/>
    <xsd:field xpath="partNumber"/>

* * * *


The example for this book was written awhile ago: in retrospect, the catalog should be a standalone element type in its own namespace (a good exercise!). Regardless, the existing schema demonstrates not only this key, but others that have the same scope as idConstraintDemo.

  • + Share This
  • 🔖 Save To Your Account