Home > Articles > Web Services > XML

  • Print
  • + Share This
From the author of

Selectors and Fields

Each identity constraint specifies a selector and one or more fields. The value of the XPath of each selector ultimately identifies a target node set in a corresponding XML instance. Each field, which is slightly more complicated, identifies one of the following:

  • The value of an element corresponding to a node in the target node set.

  • The value of an attribute of the element corresponding to a node in the target node set.

  • The value of a descendant of the element corresponding to a node in the target node set.

  • The value of an attribute of a descendant of the element corresponding to a node in the target node set.

Like a selector, a field ultimately identifies an element type or an attribute type. The XPath specified by the field is relative to the XPath specified by the selector. A key sequence is the set of values for a specific node in the target set that correspond to the set of fields specified by an identity constraint.

Here, again, is the selector from the key example:

<xsd:selector xpath="catalog/*"/>

Note that each catalog entry is one of unitCatalogEntryType, bulkCatalogEntryType, or assemblyCatalogEntryType. The selector selects every element directly below catalog elements via the '*'.

The field for the partNumberRef key specifies partNumber, which appears in each catalog entry, regardless of the entry type:

<xsd:field xpath="partNumber"/>

The effect of the partNumberRef key is to enforce that there is a distinct part number for each catalog entry, regardless of entry type.

  • + Share This
  • 🔖 Save To Your Account