XML Schema choice Element
Complete XML Schema Reference Manual
Definition and Usage
The XML Schema choice element only allows one of the elements declared in the
Element Information
- Parent elements: group, choice, sequence, complexType, restriction (both simpleContent and complexContent), extension (both simpleContent and complexContent)
Syntax
id=ID maxOccurs=nonNegativeInteger|unbounded minOccurs=nonNegativeInteger any attributes (annotation?,(element|group|choice|sequence|any)*) (The ? symbol declares that within the choice element, the element can appear zero or one time; the * symbol declares that the element can appear zero or more times.) The example above defines that the "person" element must contain either an "employee" element or a "member" element.
property
Description
id
Optional. Specifies a unique ID for the element.
maxOccurs
Optional. Specifies the maximum number of times the choice element can appear in the parent element. The value can be an integer greater than or equal to zero. If you do not want to set any limit on the maximum, use the string "unbounded". The default is 1.
minOccurs
Optional. Specifies the minimum number of times the choice element can appear in the parent element. The value can be an integer greater than or equal to zero. To specify that the any group is optional, set this attribute to zero. The default is 1.
any attributes
Optional. Specifies any other attributes with a non-schema namespace.
Example 1
Complete XML Schema Reference Manual