
XML Schemas • 155
for these two elements separately, can we not combine this declaration? The answer is yes, and that is what
we mean by content model sharing or content model reuse.
The idea is simple. Rather than declaring ProjectType and SubordinateType, we would declare a single
type, let us say NameType (for want of a better name!) and use it for both projects and subordinates. This is
shown in Figure 4.17.
<?xml version = “1.0”?>
<xsd:schema xmlns:xsd = “http://www.w3.org/2001/XMLSchema”>
<xsd:element name = “EMPLOYEE” type = “EmpType”/>
<xsd:complexType name = “NameType”>
<xsd:sequence>
<xsd:element name = “NAME” type = “xsd:string”/> ...