13.1. Identity Constraint Example

The examples in this section provide a fairly condensed, but complete XML schema and a corresponding XML instance. Listing 13.1 demonstrates more than one example of each type of identity constraint (unique, key, and keyref). The remaining sections of this chapter reiterate excerpts from this schema to emphasize specific characteristics of the identity constraints.

Listing 13.1. Compressed Order Data Schema (idConstraintDemo.xsd)
 <xsd:complexType name="compressedOrderType"> <xsd:sequence> <xsd:element name="order" minOccurs="1" maxOccurs="unbounded"> <xsd:complexType> <xsd:sequence> <xsd:element name="customerID" type="xsd:token"/> <xsd:element name="item" minOccurs="1" maxOccurs="unbounded"> <xsd:complexType> ...

Get XML Schema Complete Reference, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.