[Summary] Equivalent ways to specify an unconstrained data type

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