W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > April to June 2001

valid settings for use="..." on <attribute>s in <complexType>s derived by restriction

From: <mhuffman@ca.ibm.com>
Date: Fri, 25 May 2001 08:25:53 -0400
To: www-xml-schema-comments@w3.org
Message-ID: <OFF68ADC5E.07797FB4-ON85256A57.003FFAFB@torolab.ibm.com>
Please consider the following example:

<xsd:complexType name="baseType">
     <xsd:attribute name="attrib1" type="xsd:string" use="prohibited"/>
</xsd:complexType>

<xsd:complexType name="restrictedType">
     <xsd:complexContent>
          <xsd:restriction base="baseType">
               <xsd:attribute name="attrib1" type="xsd:string" use
="required"/>
          </xsd:restriction>
     </xsd:complexContent>
</xsd:complexType>

According to [1], 2.1.1 this is a valid restriction since 2.1.1.1 and
2.1.1.2 are both true.  I could also have used use="optional" in my
"restrictedType" and this would be valid as per 2.1.1 as well since 2.1.1.1
would still be true.

However, this would mean that XML instance data could validate OK against
"restrictedType" and NOT validate against its "baseType" if the instance
data contained a valid "attrib1" attribute.  I thought the concept of
deriving a <complexType> by restriction from a base <complexType> meant
that any instance data which validates against the restricted type MUST
also validate against its base type.  To me, this makes sense.

Am I misunderstanding derivation by restriction?  If not, is there another
portion of the XML Schema Structures spec that expressly disallows the
restriction in my example?  Thank you.

[1] http://www.w3.org/TR/xmlschema-1/#derivation-ok-restriction
------
Mark Huffman
XML Parsers, IBM Toronto Lab
(416) 448-2332     T/L 778
Received on Friday, 25 May 2001 08:26:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:50 GMT