W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2012

[Summary] Equivalent ways to specify an unconstrained data type

From: Costello, Roger L. <costello@mitre.org>
Date: Sun, 21 Oct 2012 11:28:29 +0000
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-ID: <B5FEE00B53CF054AA8439027E8FE17751E68C94E@IMCMBX04.MITRE.ORG>
Thanks Ken and Mukul.  Great!

Recap: Below are 5 equivalent ways to specify an unconstrained string. All of these forms, except the form using mixed content, can be used with the other data types as well. Thus there are 4 equivalent ways to create an unconstrained integer, 4 equivalent ways to create an unconstrained anyURI, and so forth.

    <xs:element name="E1" type="xs:string" />  
    
    <xs:element name="E2" type="string-equivalent-1" /> 
    
    <xs:element name="E3" type="string-equivalent-2" /> 
    
    <xs:element name="E4" type="string-equivalent-3" /> 
    
    <xs:element name="E5" type="string-equivalent-4" />
    
    <xs:complexType name="string-equivalent-1">
        <xs:simpleContent>
            <xs:extension base="xs:string" />
        </xs:simpleContent>
    </xs:complexType>
    
    <xs:simpleType name="string-equivalent-2">
        <xs:restriction base="xs:string" />
    </xs:simpleType>
    
    <xs:complexType name="string-equivalent-3" mixed="true" />
    
    <xs:simpleType name="string-equivalent-4">
        <xs:union memberTypes="xs:string"/>
    </xs:simpleType>

/Roger
Received on Sunday, 21 October 2012 11:28:56 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:16:02 UTC