Re: complexType names

Hi,

Daniel Acton wrote:
> 
> 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...

One of them is to define a complexType that will be used to define both
dogs and cats:

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

and to use a xsd:choice in the definition of your root element:

<xsd:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema">
  <xsd:element type="someComplexType" name="xmlRootElement"/>
  <xsd:complexType name="someComplexType">
    <xsd:choice minOccurs="..." maxOccurs="...">
	<xsd:element name="Dog" type="animal" .../>
	<xsd:element name="Cat" type="animal" .../>
    </xsd:choice>
  </xsd:complexType>
  <!-- Rest of schema definition here -->
</xsd:schema>

You'll find another example of xsd:choice in the tutorial that we've
recently published on XML.com
(http://www.xml.com/pub/a/2000/11/29/schemas/part1.html?page=4#groups).

Hope this helps.

Eric
-- 
See you at XML 2000
      http://gca.org/attend/2000_conferences/XML_2000/building.htm#vlist
------------------------------------------------------------------------
Eric van der Vlist       Dyomedea                    http://dyomedea.com
http://xmlfr.org         http://4xt.org              http://ducotede.com
------------------------------------------------------------------------

Received on Friday, 1 December 2000 05:30:12 UTC