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

SimpleType not enforced for extended element

From: Karl Stubsjoen <kstubs@gmail.com>
Date: Thu, 5 Jan 2012 17:48:02 -0700
Message-ID: <CAHL+Fe3Vra_Zd+BiVgdNfmjDPi3t1MnV0qzf2v_V64y_+cCZYA@mail.gmail.com>
To: xmlschema-dev@w3.org
I have an element that extends a complex type but the additional
attribute with a simple type definition is not being enforced.  The
attribute is enforced, just not it's simple type.  Have I defined
something incorrectly?  Here they are:

<!-- to be used in extension below -->
    <xs:complexType name="ProjXm_QueryType">
        <xs:sequence>
            <xs:element ref="command"/>
            <xs:element ref="parameters"/>
            <xs:element ref="fields" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>


<!-- extends the above and adds a name attribute of specified simple type -->
    <xs:element name="SharedDB">
        <xs:complexType>
            <xs:complexContent>
                <xs:extension base="ProjXm_QueryType">
                    <xs:attribute name="name"
type="simpleType_SharedDBQueries" />
                </xs:extension>
            </xs:complexContent>
        </xs:complexType>
    </xs:element>

<!-- expected values for name attribute ->
    <xs:simpleType name="simpleType_SharedDBQueries">
        <xs:restriction base="xs:NCName">
            <xs:enumeration value="insert"/>
            <xs:enumeration value="update"/>
        </xs:restriction>
    </xs:simpleType>


<!-- sample xml (snipped) -->
    <SharedDB>
        <command>
            <name>insertxx</name><!-- would expect validation to fail here -->
            <type>StoredProcedure</type>
            <action>NonQuery</action>
        </command>
        <parameters>
    ...
    </SharedDB>


Thanks,
Karl..
Received on Friday, 6 January 2012 00:48:31 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 6 January 2012 00:48:32 GMT