XML Schema Complete Reference, The
by Cliff Binstock, Chris Galtenberg, Mike Wooding, Chris Dix, Mitchell Smith, Dave Peterson
13.4. The key Element
The key identity constraint assures that each key sequence—the set of values specified by the XPath expressions of the nested field elements—is unique. A key sequence is unique if no two key sequences have “equal” values for all keys. Unlike the unique element, a key sequence must exist for each node in the target node set. The key identity constraint is appropriate, for example, for required elements or attributes.
Note
The uniqueness of the key sequence specified by the set of field elements is relative to the element specified by the selector element.
The uniqueness of the keys is dependent on the selector. In the example for this chapter, an identity constraint confines an order to no more than one part number. However, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access