The second entry in the sequence is an xs:choice which specifies the possible fields. The order in the xs:choice determines the value of the SwitchField when that choice is encoded. The first element has a SwitchField valueof 1 and the last value has a SwitchField equal to the number of choices.
No additional elements in the sequence are permitted. If the SwitchField is missing or 0 then the union has a NULL value.Encoders or decoders shall report an error for any SwitchFieldvalue greater than the number of defined union fields.
The name attribute restricts the set of characters that are permitted. See 5.3.5for instructions on how to handle invalid characters.
For example, the following union has two fields. The XML schema would look like:
<xs:element name="Field1" type="xs:int" minOccurs="0"/>
<xs:element name="Field2" type="tns:Field2" minOccurs="0"/> </xs:choice>