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

Extending a schema by adding choices

From: Daniel Flippance <DFlippance@mpsbc.com>
Date: Thu, 23 Aug 2001 13:01:34 -0400 (EDT)
Message-ID: <CBD544BC645DD211895800105A11F2CEAD3DF6@MPSNTSERVER1>
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
We are trying to define 2 schemas, one which allows 2 options in an
xsd:choice, and one which extends this and allows 3 options.
If one schema defines 2 choices of elements, can this list of choices be
extended in a deriving schema?
eg:

<xsd:complexType name="Contact">
  <xsd:complexContent>
    <xsd:choice>
      <xsd:element name="Telephone" type="xsd:string" />
      <xsd:element name="Fax" type="xsd:string" />
    </xsd:choice>
  </xsd:complexContent>
</xsd:complexType>

Allows for example:
<MyContact>
  <Telephone>(123) 456 7890</Telephone>
</MyContact>
<MyContact>
  <Fax>(987) 654 3210</Fax>
</MyContact>

I have used the basic xsd:string type for example only.

Is it possible to also allow the following in a deriving schema:

<MyContact>
  <EMail>Bill@Place.com</EMail>
</MyContact>

My guess is that this can't be done, but I wonder if the <xsd:extension>
element can be for this type of definition...

Thanks,
Daniel Flippance
Senior Software Engineer
Meridian Project Systems
Received on Friday, 24 August 2001 04:56:05 GMT

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