W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2004

Extending abstract elements with a choice

From: Shane Lauf <srl01@uow.edu.au>
Date: Thu, 2 Sep 2004 12:24:59 +1000
To: <xmlschema-dev@w3.org>
Message-ID: <E1C2hIb-0004Gw-Rf@frink.w3.org>

I have a question about extending abstract elements with a choice, and
maintaining substitutability.

Say I have an abstract element myAbstractElement, defined with some child
elements which all have minOccurs=0 attributes set.

      <xsd:sequence>
       <xsd:element ref="Object1" minOccurs="0"/>
       <xsd:element ref="Object2" minOccurs="0"/>
      </xsd:sequence>

Is there a way that I can extend/restrict myAbstractElement to another
element myConcreteElement, which ends up with a definition semantically
equivalent to: 
     <xsd:sequence>
     <xsd:choice>
      <xsd:element ref="SpecialObject1"/>
      <xsd:sequence>
       <xsd:element ref="Object1" minOccurs="0"/>
       <xsd:element ref="Object2" minOccurs="0"/>
      </xsd:sequence>
     </xsd:choice>
    </xsd:sequence>

- in otherwords, so that myConcreteElement must have one or the other of
[the child elements as defined in myAbstractElement i.e. Object1 and Object
2], [a SpecialObject1 child] - and still be substitutable for
myAbstractElement?

Regards,

Shane
Received on Thursday, 2 September 2004 02:26:05 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:06 UTC