<xs:complexType name="elementWithBookID">
<xs:complexContent>
<xs:restriction base="elementWithID">
<xs:attribute name="id" type="bookID"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="book">
<xs:complexContent>
<xs:extension base="elementWithBookID">
<xs:sequence>
<xs:element ref="isbn"/>
<xs:element ref="title"/>
<xs:element ref="author" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element ref="character" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute ref="available"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
Using the elementWithID to derive by extension a
personType, which can then be used to derive the
author and character elements
by restriction, is straightforward, if not concise. We have already
seen this example. The full schema is then: