Substitution Groups

One new powerful feature of XML Schemas is a Substitution group, which is simply a grouping of elements that can be substituted for one another. The element that serves as the basis for the group is called the head element. Let's look at an example:

<xs:element name="customer" type="xs:string" /> 
<xs:element name="myspace:phone" type="xs:string" />

<xs:element name="USphone" type="xs:string"

<xs:element name="INTphone" type="xs:string"

<xs:element name="contact">
      <xs:element ref="customer"/>
      <xs:element ref="myspace:phone"/>

In this example, we start by declaring a <customer> ...

Get Special Edition Using XML, Second Edition 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.