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

RE: Multiple inheritance

From: <Simon.Cox@csiro.au>
Date: Thu, 29 Aug 2002 13:46:24 +0800
Message-ID: <116D27C8E12BD411B3AB00B0D022B0B8010E5A5C@yate.wa.csiro.au>
To: erobertsson@allette.com.au, md.ais40@wanadoo.fr
Cc: xmlschema-dev@w3.org

What Eddie says is correct.  
XML Schema type derivation only allows one "base" type.  

However, it is possible to simulate multiple inheritance in part using named
content model groups.  
You can build content models (either types or groups) by including
references to previously defined groups.  

The "pure" form of this would see all content models built as named groups,
then each XML Schema type definition would merely use a single group. 
Unfortunately this only works for element content, not attributes, and also
requires you to keep track of yet another meta-level in the schema - the
groups.  

But it can be done.  


> -----Original Message-----
> From: Eddie Robertsson [mailto:erobertsson@allette.com.au]
> Sent: Thursday, 29 August 2002 8:17 AM
> To: Mathieu DUBOS
> Cc: xmlschema-dev@w3.org
> Subject: Re: Multiple inheritance
> 
> 
> 
> Hi Mathiue,
> 
> > I'm looking for making a double inheritance and don't 
> manage doing so.
> > What I would like is that an element inherits attributes 
> from a first 
> > type defined in a xsd file, and also inherits attributes 
> from a second 
> > type defined in a second xsd file.
> >
> > I tried kind of things like :
> >
> >   <xs:complexType name="Type0">
> >     <xs:complexContent>
> >       <xs:extension base="dt1:DataType1">
> >         <xs:extension base="dt2:DataType2"/>
> >         <xs:attribute name="comment" type="xs:string" 
> use="required"/>
> >       </xs:extension>
> >     </xs:complexContent>
> >   </xs:complexType>
> >
> > but errors occur when i parse a xml instance with xerces-j.
> >
> > Someone could help me??
> 
> There's currently no way to do multiple inhertance in W3C XML Schema.
> 
> Cheers,
> /Eddie
> 
> >
> > thx a lot
> >
> > ----
> > Mathieu DUBOS
> >
> >
> >
> >
> 
Received on Thursday, 29 August 2002 01:46:29 GMT

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