Defining Groups of Elements and Attributes in XML Schemas

The XML Schema Recommendation allows you to specify groups of elements and groups of attributes. Here is an example of an element group, purchaseType:

 <xsd:group name="purchaseType">
         <xsd:element name="retail"/>
         <xsd:element name="internet"/>
         <xsd:element name="mailOrder"/>


Specification of a group makes it easier to update the schema. You only need to update the group definition. There is no need to change the references to the group.

Here is an example of an attributeGroup, deliveryDetail.

 <xsd:attributeGroup name="deliveryDetail">
     <xsd:attribute name="method"/>
     <xsd:attribute name="vendor"/>
     <xsd:attribute name="dateShipped"/>
     <xsd:attribute name="dateArrived"/>


This section discusses the following topics:

Free Stylus Studio XML Training:
W3C Member