xs:all

Purpose This element is used when defining elements using the xs:all particle in a complex type definition, meaning that the child elements can appear in arbitrary order, and that each child element can occur at most once (if the value of the minOccurs attribute is 0) or must occur exactly once (if the value of the minOccurs attribute is 1).
Parent element xs:complexType, xs:extension, xs:group
Child elements xs:element
Attributes minOccurs, maxOccurs
Attributes
Name Type Description
minOccurs xs:nonNegativeInteger

Together with the maxOccurs attribute described below, this attribute expresses multiplicity in TSD (and XML Schema) in xs:all elements within a content model. The value of a minOccurs attribute declaration determines the minimum number of occurrences of xs:all. The value of minOccurs must be 0 or 1.

Note:
A similar minOccurs parameter is also available for the xs:element element.

maxOccurs xs:nonNegativeInteger Together with the minOccurs attribute described above, this attribute expresses multiplicity in TSD (and XML Schema) in xs:all elements within a content model. The value of a maxOccurs attribute determines the maximum number of occurrences of an xs:all element. The value of maxOccurs may only be 1.

Example 1

The following example indicates that the cl_firstname and the cl_lastname elements can appear in either order but each element must occur exactly once.

<xs:element name="client">
  <xs:complexType>
    <xs:all>
      <xs:element name="cl_firstname" type="xs:string"/>
      <xs:element name="cl_lastname" type="xs:string"/>
    </xs:all>
  </xs:complexType>
</xs:element>

Example 2

The following example indicates that the customer_firstname and the customer_lastname elements can appear in either order and each child element is optional.

<xs:element name="customer">
  <xs:complexType>
    <xs:all minOccurs="0">
      <xs:element name="customer_firstname" type="xs:string"/>
      <xs:element name="customer_lastname" type="xs:string"/>
    </xs:all>
  </xs:complexType>
</xs:element>