Elements

Each element defined in a choice or a sequence type has a name and a type attribute.

The name attribute uniquely identifies the element among the other elements of the sequence or the choice type. The type attribute references a complex type defined in the abstract syntax schema.

By convention, the name of an element is often the same as the name of its type, unless several elements of the sequence or choice have the same type, as shown in this example:

<complexType name="T-ifThenElseRule">
   <sequence>
     <element name="condition" type="T-condition"/>
     <element name="thenAction" type="T-action"/>
     <element name="elseAction" type="T-action"/>
  </sequence>
</complexType>

Multiple occurrences of elements

An element that is part of a sequence type can have minOccurs and maxOccurs attributes, which limit the number of occurrences of the element in the sequence.

The following example shows elements with explicit minOccurs and maxOccurs attributes:

<complexType name="T-rule">
  <sequence>
     <element name="condition" type="T-condition" 
              minOccurs="1" maxOccurs="unbounded"/>
     <element name="action" type="T-action" 
              minOccurs="0" maxOccurs="unbounded"/>
  </sequence>
</complexType>

The possible values for minOccurs and maxOccurs are:

minOccurs maxOccurs Description
0 unbounded Optional Multiple: any number of elements
1 unbounded Multiple: at least one element
0 1 Optional: optional element
1 1 Only Once: exactly one element (default)

An element that is part of a choice type cannot have explicit minOccurs and maxOccurs attributes. It must appear only once.