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

Home
XML Tutorial
1.Introduction
2.Namespace
3.XML Schema
4.XPath
5.XSLT stylesheet
XML Tutorial » XML Schema » union 
3.80.2.The union method joins the value spaces and lexical spaces of one or more datatypes to derive a new type
<!-- 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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.