A compound type element that contains only elements is an element that can only contain other elements. The XML element, “person”, contains only other elements: You can define the “person” element in schema as follows: Please pay attention to this. It means that the defined elements must appear in the “person” element in the above order. Or you can set a name for the complexType element and have the type attribute of the “person” element refer to this name (if you use this method, several elements can refer to the same compound type):Compound types contain only elements ¶
<person>
<firstname>John</firstname>
<lastname>Smith</lastname>
</person>
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="person" type="persontype"/>
<xs:complexType name="persontype">
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
</xs:complexType>