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

Complex content extension

From: zze-MARCHEGAY Michael stagiaire FTRD/DTL/LAN <michael.marchegay@rd.francetelecom.com>
Date: Tue, 6 Aug 2002 11:34:49 +0200
Message-ID: <0489A7888F080B4BA73B53F7E145F29A197C91@LANMHS20.rd.francetelecom.fr>
To: <xmlschema-dev@w3.org>

Hi all,

I would like to have clarifications about complex content extension 
attributes. 

I read in the book "Definitive XML Schema" that complex content extensions
"cannot modify or remove existing attributes". I found the same kind of 
statement in another book: "Professional XML Schemas".

I tried to find the paragraph that explains this behaviour in the 
Recomendation, but I haven't managed to get it. However, I found a paragraph
that introduced doubt about my understanding of those complex content 
extensions:

3.4.6 Constraints on Complex Type Definition Schema Components
[...]
Schema Component Constraint: Derivation Valid (Extension) 

If the {derivation method} is extension, the appropriate case among the following must be true:
1 If the {base type definition} is a complex type definition, then all of the following must be true:
1.1 The {final} of the {base type definition} must not contain extension. 
1.2 Its {attribute uses} must be a subset of the {attribute uses} of the complex type definition itself, that is, for every attribute use in the {attribute uses} of the {base type definition}, there must be an attribute use in the {attribute uses} of the complex type definition itself whose {attribute declaration} has the same {name}, {target namespace} and {type definition} as its attribute declaration.
[...]

Using the book and the Recommandation text, I deduced that the following 
schema should be invalid but but according to SQC and XSV it is not.

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <xsd:complexType name="foo">
    <xsd:attribute name="a" type="xsd:boolean" use="optional"/>
  </xsd:complexType>

  <xsd:complexType name="bar">
    <xsd:complexContent>
      <xsd:extension base="foo">
        <xsd:attribute name="a" type="xsd:boolean" use="required"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:complexType name="bar-2">
    <xsd:complexContent>
      <xsd:extension base="foo">
        <xsd:attribute name="a" type="xsd:boolean" use="prohibited"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
</xsd:schema>

Can you help me to understand these complex content extension stuff?

Thanks,

Michael.

--
MichaŽl Marchegay, Stagiaire France Telecom R&D du 11/02/2002 au 26/07/2002
Sous la responsabilitť d'Olivier Dubuisson
DTL/TAL - 22307 Lannion Cedex - France
Received on Tuesday, 6 August 2002 05:34:57 GMT

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