Note: When using the <all> indicator you can set the <minOccurs>
indicator to 0 or 1 and the <maxOccurs> indicator can only be set to 1 only(the <minOccurs>
and <maxOccurs> are described later
Choice Indicator
The <choice> indicator specify that either one child element or another can occur:
Occurrence indicator are used to define how often an
element can occur.
Note: For all "Order" and "Group"
indicators (any, all, sequence, choice, group name, and group
reference) the default value for maxOccurs and minOccurs is 1.
maxOccurs Indicator
The <maxOccurs> indicator specify the maximum number of times an element can occur:
The example above indicate that the "child_name" element can occur a minimum of one
time (the default value for minOccurs is 1) and a maximum of ten times in the "person" element.
minOccurs Indicator
The <minOccurs> indicator specify the minimum number of times an element can occur:
The XML file above contain a root element named "persons".
Inside this root element we have defined three "person"
element. Each "person" element must contains "full_name"
element and it can contain up to five "child_name" elements.
Group indicators are used to define related set of elements.
Element Groups
Element groups are defined with the group declaration as follows:
<xs:group name="groupname">
...
</xs:group>
You must define an all, choice, or sequence elements inside the group declaration.
The following example defines a group named "persongroup", that defines
a group of elements that must occur in an exact sequence: