The union method joins the value spaces and lexical spaces of one or more datatypes to derive a new type : union « XML Schema « XML Tutorial






<!-- schema -->
<xsd:element name="recipe">
  <xsd:simpleType>
   <xsd:union>
    <xsd:simpleType>
    <xsd:restriction base="decimal"/>
    </xsd:simpleType>
    <xsd:simpleType>
     <xsd:restriction base="string"/>
    </xsd:simpleType>
   </xsd:union>
  </xsd:simpleType>
</xsd:element>

<!-- instance document -->
<recipe>1.5</recipe>
<recipe>cups</recipe>








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