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

RE: complexType names

From: David Valera <dvalera@pcl-hage.nl>
Date: Fri, 1 Dec 2000 13:30:37 +0100
To: "'Eric van der Vlist'" <vdv@dyomedea.com>, <xmlschema-dev@w3.org>
Message-ID: <D1F94D8C7C1FD111A5290020AF92B1B3B03A1A@INTRASERVER>
> > The two instances will have the same elements, but with a
> different root
> > element. Do I have to write two seperate schemas for this?
> The examples
> > I've been looking at have this kind of definition of the
> root element:
>
> You have many ways to do it, the only common point being that you'll
> have to use a xsd:choice at some point...

what about this:

<xsd:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema">
  <xsd:element name="Cat" type="AnimalType"/>
  <xsd:element name="Dog" type="AnimalType"/>

  <xsd:complexType name="AnimalType">
    <xsd:sequence>
      <xsd:element name="height" .../>
      <xsd:element name="weight" .../>
    </xsd:sequence>
  </xsd:complexType>
...
</xsd:schema>

I recall using a construction like this when I started with XML schema's.
XMLSpy did validate, but I am not quite sure if it is allowed. I prefer
using different XML schema's...

--
David Valera
Received on Friday, 1 December 2000 07:29:57 GMT

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