Friday, 7 November 2014

Derivation by union


<xs:union> element defines a simple type as a collection (union) of values from specified simple data types.

        <!-- define type block -->
        <xs:simpleType name="block">
            <xs:restriction base="xs:string" />
        </xs:simpleType>

        <!-- Define cubicleNum -->
        <xs:simpleType name="cubicleNum">
            <xs:restriction base="xs:integer" />
        </xs:simpleType>

        <!-- Deinfe wing -->
        <xs:simpleType name="wing">
            <xs:restriction base="xs:string">
                <xs:enumeration value="west" />
                <xs:enumeration value="east" />
            </xs:restriction>
        </xs:simpleType>

        <xs:element name="cubicleDetails">
            <xs:simpleType>
                <xs:union memberTypes="block wing cubicleNum" />
            </xs:simpleType>
        </xs:element>

Prevoius                                                 Next                                                 Home

No comments:

Post a Comment