Tuesday, August 21, 2012

xsd:all

<xsd:all>

  • All the elements in the group may appear once or not at all, and they may appear in any order. 
  • The all group is limited to the top-level of any content model. 
  • The group's children must all be individual elements (no groups - sequence or all)

For example, to allow the child elements of purchaseOrder to appear in any order, we could redefine PurchaseOrderType as:


<xsd:complexType name="PurchaseOrderType">
  <xsd:all>
    <xsd:element name="shipTo" type="USAddress"/>
    <xsd:element name="billTo" type="USAddress"/>
    <xsd:element ref="comment" minOccurs="0"/>
    <xsd:element name="items"  type="Items"/>
  </xsd:all>
  <xsd:attribute name="orderDate" type="xsd:date"/>
</xsd:complexType>


Reference: http://www.w3.org/TR/2001/REC-xmlschema-0-20010502/

No comments:

Post a Comment