RE: complexType names

> > 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 UTC