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 |
Name | Type | Description |
---|---|---|
minOccurs |
xs:nonNegativeInteger |
Together with the Note: |
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.
|
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>
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>