Allows one and only one of the elements contained in the selected group to be present within the containing element.
<choice id = ID maxOccurs= (nonNegativeInteger | unbounded) : 1 minOccurs= nonNegativeInteger : 1 {any attributes with non-schema Namespace}…> Content: (annotation?, (element | group | choice | sequence | any)*) </choice>
Optional.
Optional.
Optional.
Number of occurrences | One within group and complexType elements; otherwise, unlimited. |
Parent elements | group, choice, sequence, complexType, restriction (simpleContent), extension (simpleContent), restriction (complexContent), extension (complexContent) |
Contents | annotation, any, choice, element, group, sequence |
The following complex type defines an element with one attribute and one and only one element from a choice of four specified elements.
<xs:complexType name="chadState"> <xs:choice minOccurs="1" maxOccurs="1"> <xs:element ref="selected"/> <xs:element ref="unselected"/> <xs:element ref="dimpled"/> <xs:element ref="perforated"/> </xs:choice> <xs:attribute name="candidate" type="candidateType"/> </xs:complexType>
XML Schema Reference (XSD) | XML Schema Elements
For more information, see the W3C XML Schema Part 1: Structures Recommendation at http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-choice.