<xsd:sequence> Element 

Requires the elements in the group to appear in the specified sequence within the containing element.

<sequence
  id = ID 
  maxOccurs = (nonNegativeInteger | unbounded) : 1 
  minOccurs = nonNegativeInteger : 1 
  {any attributes with non-schema Namespace}...>
Content: (annotation?, (element | group | choice | sequence | any)*)
</sequence>

Attributes

  • id
    The ID of this element. The id value must be of type ID and be unique within the document containing this element.

    Optional.

  • maxOccurs
    The maximum number of times the sequence can occur. The value can be an integer greater than or equal to zero. To set no limit on the maximum number, use the string "unbounded".

    Optional.

  • minOccurs
    The minimum number of times the sequence can occur. The value can be an integer greater than or equal to zero. To specify that this sequence group is optional, set this attribute to zero.

    Optional.

Element Information

Number of occurrences

One time within group; otherwise, unlimited.

Parent elements

group, choice, sequence, complexType, restriction (simpleContent), extension (simpleContent), restriction (complexContent), extension (complexContent)

Contents

annotation, any, choice, element, group, sequence

Example

The following example shows an element (zooAnimals) that can have zero or more of the following elements, elephant, bear, giraffe, in the sequence element.

<xs:element name="zooAnimals">
      <xs:complexType>
            <xs:sequence minOccurs="0" maxOccurs="unbounded">
               <xs:element name="elephant"/>
               <xs:element name="bear"/>
               <xs:element name="giraffe"/>
            </xs:sequence>
      </xs:complexType>
</xs:element>

Other Resources

For more information see the W3C XML Schema Part 1: Structures Recommendation at www.w3.org/TR/2001/REC-xmlschema-1-20010502\#element-all.

See Also

Reference

XML Schemas (XSD) Reference
XML Schema Elements