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

Re: complexType names

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Fri, 01 Dec 2000 14:04:26 +0100
Message-ID: <3A27A1DA.147426E@dyomedea.com>
To: xmlschema-dev@w3.org
Daniel Acton wrote:
> > <xsd:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema">
> >   <xsd:element type="someComplexType" name="xmlRootElement"/>
>                                               ^^^^^^^^^^^^^^
> That's exactly where my problem lies, I'm afraid. I stand to correction,
> but the above line is explicitly telling the schema validator to look for
> an element (in this case the root element) called 'xmlRootElement'. I am
> trying to steer clear of this, so that I can use the schema in the most
> extensible way possible.

Oops sorry, I must have read your email too fast.

Then the good news is that W3C XML Schema doesn't ask you to specify the
name of the document element.

<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
	<xsd:complexType name="animal">
			<xsd:element name="height" type="xsd:string"/>
			<xsd:element name="weight" type="xsd:string"/>
	<xsd:element name="Dog" type="animal"/>
	<xsd:element name="Cat" type="animal"/>

will validate both cat.xml and dog.xml.


> Ideally, I wish to have one schema and n xml documents, and validate any existing (or any new xml document that may come up in the future) xml
> document of this kind. What I am thinking of is abstracting this name from
> the schema validator, and building a wrapper around the validator (I'm
> using Oracle's Java validator).
> Thanks for the help.
> Daniel
> >   <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>
> >

See you at XML 2000
Eric van der Vlist       Dyomedea                    http://dyomedea.com
http://xmlfr.org         http://4xt.org              http://ducotede.com
Received on Friday, 1 December 2000 08:01:41 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:14:48 UTC