When the values of a union datatype are validated, they’re validated in the order in which they’re defined : union « XML Schema « XML Tutorial






<!-- schema -->
<xsd:element name="dog">
  <xsd:simpleType>
   <xsd:union>
    <xsd:simpleType>
    <xsd:restriction base="nonNegativeInteger"/>
   </xsd:simpleType>
   <xsd:simpleType>
   <xsd:restriction base="string"/>
   </xsd:simpleType>
  </xsd:union>
  </xsd:simpleType>
 </xsd:element>
<!-- instance document -->
<dog>15</dog>
<dog>hound</dog>








3.80.union
3.80.1.By declaring a , you can validate the values in your instance document against multiple types.
3.80.2.The union method joins the value spaces and lexical spaces of one or more datatypes to derive a new type
3.80.3.When the values of a union datatype are validated, they’re validated in the order in which they’re defined