W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2003

extensibility for enumeration item in simple type

From: Avin Patel <avinpatel@iit.edu>
Date: Wed, 2 Apr 2003 12:00:40 -0500
Message-ID: <018a01c2f939$676f1360$493e0942@Avin>
To: "xmlschema-dev" <xmlschema-dev@w3.org>

Hi All,
How can I extend the enumeration item in simple type. 
e.g. If I have following definition:
<xsd:simpleType name="Color">
    <xsd:restriction>
        <xsd:enumeration value="red"/>
        <xsd:enumeration value="yellow"/>
        <xsd:enumeration value="blue"/>
    </xsd:restriction>
</xsd:simpleType>

Though I want the user to define extra colors, so can I write like this:
<xsd:simpleType name="Color">
    <xsd:union memberTypes="xsd:token">
    <xsd:simpleType>
        <xsd:restriction>
            <xsd:enumeration value="red"/>
            <xsd:enumeration value="yellow"/>
            <xsd:enumeration value="blue"/>
        </xsd:restriction>
    </xsd:simpleType>
    </xsd:union>
</xsd:simpleType>

Is there any other way to write this definition?

Thank you for your help.
Avin Patel
Received on Wednesday, 2 April 2003 12:00:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:36 GMT