Home > Articles > Web Services > XML

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

Like this article? We recommend

The keyref Element

The keyref identity constraint assures that each key sequence specified by the keyref exists, by virtue of equality, as a key sequence in the reference identity constraint. The reference identity constraint is always a unique or key identity constraint.

The following example specifies that every item in an order must exist in the list specified by the already specified partNumberKey:

<xsd:keyref name="partNumberRef"
    <xsd:documentation xml:lang="en">
      Each order must refer to a known part number.
  <xsd:selector xpath="compressedOrder/order/item"/>
  <xsd:field xpath="partNumber"/>

Note that while this article does not provide examples (the book does!), a unique, key, and keyref each might specify multiple fields (that is, a multi-valued key such as "last name" and "first name" combined).

  • + Share This
  • 🔖 Save To Your Account