XML Schema sequence
Element
Definition and Usage
The sequence
element requires that elements in the group appear in a specified order within the containing element. Each child element can occur from 0 to any number of times.
Element Information
- Parent Elements: group, choice, sequence, complexType, restriction (both simpleContent and complexContent), extension (both simpleContent and complexContent)
Syntax
(? The declaration indicates that the element can appear zero or one time within the sequence
element.)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element. |
maxOccurs | Optional. Specifies the maximum number of times the any element can appear within the parent element. The value can be an integer greater than or equal to zero. Use the string "unbounded" if you do not want to set any limit on the maximum number of occurrences. The default value is 1. |
minOccurs | Optional. Specifies the minimum number of times the any element can appear within the parent element. The value can be an integer greater than or equal to zero. Set this attribute to zero to indicate that the any group is optional. The default value is 1. |
any attributes | Optional. Specifies any other attributes with non-schema namespaces. |
Example 1
This example is a declaration for the "personinfo" element, which must contain the following 5 elements in order: "firstname", "lastname", "address", "city", and "country".
Example 2
This example is a declaration for the "pets" element, which can contain zero or more dog
and cat
elements: