Mega Code Archive

 
Categories / XML Tutorial / XML Schema
 

All Declarations

<all> says that the elements within your content model may appear in any order. <all> must be the only content model declaration that appears as a child of a <complexType> definition.  <all> cannot contain <sequence>, <choice>, or <group> declarations.  <all> declaration's children may appear once each in the instance document.  Within the <all>, the values for minOccurs/maxOccurs are limited to 0 or 1.  <all> is used when the expected content is known, but not the order.  Suppose you declared the <name> content model using the <all>:  <element name="name"     <complexType>         <all>             <element name="first" type="string"/             <element name="middle" type="string"/             <element name="last" type="string"/         </all>         <attribute name="title" type="string"/     </complexType> </element> The allowable content for a <name> element declared using an <all> declaration might include  <name>     <first>first</first>      <middle>middle</middle>      <last>last</last>  </name> or  <name>     <first>first</first>      <last>last</last>      <middle>middle</middle>  </name>