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:choice>
               
         <xsd:element name="retail"/>
               
         <xsd:element name="internet"/>
               
         <xsd:element name="mailOrder"/>
               
     </xsd:choice>
               
 </xsd:group>
               

            

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"/>
               
 </xsd:attributeGroup>
               

            

This section discusses the following topics:

XQuery Talk

Join the XQuery Talk mailing list for a practical discussion about XQuery. It's a place to work together to learn a new language, talk about problem solutions, discuss engines and implementations, chat about the latest XQuery news and more.

Export HTML to XML

Export HTML to XML with the click of a button - simplify migration of legacy HTML code to industry standard XML technologies with Stylus Studio.

How to Build PDF Forms using Stylus Studio

Learn how to build PDF Forms using Stylus Studio and the RenderX XEP FO processor

XML Schema Documentation Generator

Stylus Studio's XML Schema Editor includes an integrated XML Schema documentation generator, allowing you to easily publish XML content models defined in XML Schema in a convenient, HTML format. A screenshon of the XML Schema Editor is shown here.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member