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

Type derivation problem

From: Guillaume Rousse <rousse@ccr.jussieu.fr>
Date: Fri, 24 Aug 2001 12:09:29 +0200
To: xmlschema-dev@w3.org
Message-Id: <20010824100930.1C1FB2C77@silbermann.snv.jussieu.fr>
Hello.
I would like to derive a basic type by extension , allowing to add other 
elements and attributes, while restraining some inherited elements allowed 
values. In classical OO language, i would just override get/set methods, but 
is it legal using XML schema ?

Exemple:
I have such a basic Event type, whose date is any year and non mandatory:
<complexType name="EventType" abstract="true">
  <sequence>
    <element name="year" type="gYear" minOccurs="0" maxOccurs="1"/>
  </sequence>
</complexType>

And such a NameCreation type, whose date is any year>1758, mandatory:
<complexType name="NameCreationType">
  <complexContent>
    <extension base="model:EventType">
      <sequence>
        <element name="foo" type="bar" minOccurs="1" maxOccurs="1"/>
        <element name="year" minOccurs="1" maxOccurs="1">
          <simpleType>
            <restriction base="gYear">
              <minInclusive value="1758"/>
            </restriction>
          </simpleType>
        </element>
      </sequence>
    </extension>
  </complexContent>
</complexType>

-- 
Guillaume Rousse <rousse@ccr.jussieu.fr>
GPG key http://bohm.snv.jussieu.fr/~rousse/gpgkey.html
Received on Friday, 24 August 2001 06:10:37 GMT

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