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

attribute required in base type/prohibited in derived type

From: Tom Moog <tmoog@sarvega.com>
Date: Fri, 26 Apr 2002 12:32:46 -0500
Message-ID: <3CC98F3E.966EA847@sarvega.com>
To: xmlschema-dev@w3.org

Hello,

Both MSV -strict and SQC accept the following complex types, but
I don't understand why attribute A2 can be required in a base type,
and prohibited in a derived type, and still satisfy the requirement that

all  derived types should be compatible with the base type.

Obviously, I'm missing something.

P.S. Replacing "extension" with "restriction" in the derived type
doesn't make any difference: both processors still accept it.

Tom Moog

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >

<xsd:complexType name="base">
   <xsd:complexContent>
  <xsd:restriction base="xsd:anyType" >
     <xsd:attribute name = "A2" type="xsd:string" use="required"/>
  </xsd:restriction>
   </xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="derived">
   <xsd:complexContent>
      <xsd:extension base="base">
         <xsd:attribute name = "A2" type="xsd:string" use="prohibited"/>

     </xsd:extension>
   </xsd:complexContent>
</xsd:complexType>

<xsd:element name="derived" type="derived" />
<xsd:element name="base" type="base" />

</xsd:schema>
Received on Friday, 26 April 2002 13:34:48 GMT

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