XML Schema Reference

Folder Left Edge Island Home Folder Right Edge
Folder Left Edge Components Online Reference Folder Right Edge
Folder Left Edge Text Page Complete Reference Folder Right Edge
Folder Left Edge Text Page W3C Recs Folder Right Edge
Folder Left Edge Examples Examples Folder Right Edge
Folder Left Edge ? Consulting & Training Folder Right Edge

The choice Element

The choice element provides an XML representation for describing a selection from a set of element types. An XML instance contains elements that correspond to a selection from the set of element types defined by the choice element in an XML Schema Document. The minOccurs and maxOccurs attributes may permit the XML instance to select several (e.g., between two and four) occurrences of element types from the set.
    <xsd:group name="priceGroup">
        <xsd:annotation>
            <xsd:documentation xml:lang="en">
                A price is any one of the following:
                    * Full Price (with amount)
                    * Sale Price (with amount and authorization)
                    * Clearance Price (with amount and authorization)
                    * Free (with authorization)
            </xsd:documentation>
        </xsd:annotation>
        <xsd:choice id="pg.choice">
            <xsd:element name="fullPrice"
                         type="fullPriceType"/>
            <xsd:element name="salePrice"
                         type="salePriceType"/>
            <xsd:element name="clearancePrice"
                         type="clearancePriceType"/>
            <xsd:element name="freePrice" type="freePriceType"/>
        </xsd:choice>
    </xsd:group>