W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2001

Redeclaring attribute in derived type

From: Jesse McCarthy <mccarthy36@earthlink.net>
Date: Wed, 19 Dec 2001 21:12:56 -0500
To: xmlschema-dev@w3.org
Message-ID: <MWMail.mefbgijl@host.none>
Sorry if this has already been asked and answered, but the search function 
doesn't work blah blah blah, you know how that go. 

This is a question about schema structure.

Can I redeclare an attribute when deriving a complexType?  For example, if I 
want to create a generic type that specifies a minimal content model and one 
or more attributes and I want to derive other types from that, adding to the 
content model. and restricting the value of an attribute of the base type by 
setting a fixed or default value or restricting the value, etc.  e.g. 



<xsd:complexType name="BaseType">


    <xsd:element ref="JMM:someElementABC" />


  <xsd:attribute name="id" type="xsd:ID" />


<xsd:complexType name="DerivedType">


    <xsd:extension base="JMM:BaseType">


        <xsd:element ref="JMM:someElementXYZ" />


      <xsd:attribute name="id" type="xsd:ID" fixed="Derived" />






The spec /seems/ to rule this out, but it would provide a useful facility for 
me, and the XSV schema validator linked from the W3C schema page doesn't seem 
to have a problem with it. 

Relevant parts of the spec:


Complex Type Definition with simple content Schema Component

{attribute uses}

A union of sets of attribute uses as follows 
1 The set of attribute uses corresponding to the <attribute> [children], if 
any. ...
3 if the type definition ·resolved· to by the ·actual value· of the base 
[attribute] is a complex type definition, the {attribute uses} of that type 
definition, ... 



3.4.6 Constraints on Complex Type Definition Schema Components

Schema Component Constraint: Complex Type Definition Properties Correct 

All of the following must be true:

4 Two distinct attribute declarations in the {attribute uses} must not have 
identical {name}s and {target namespace}s. ...


What do you make of this?

(please CC me when replying)

--> Jesse
Received on Wednesday, 19 December 2001 21:21:48 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:14:56 UTC