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

Re: DTD OR equivalent in XML schema

From: David Vázquez Guerrero <d_vazquez_g@yahoo.com>
Date: Tue, 5 Sep 2000 11:02:08 -0500 (CDT)
Message-ID: <20000905160208.24810.qmail@web1404.mail.yahoo.com>
To: Neil Archer <neil.archer@viewgate.com>, "XML Schema List \(E-mail\)" <xmlschema-dev@w3.org>
There is a "choice" element that allows choosing one
of several elements.

Try 

<choice>
    <element ref="A" minOccurs="1" maxOccurs="1"/>
    <element ref="B" minOccurs="1" maxOccurs="1"/>
</choice>

where A and B have been declared separately, or you
could include the name and type of those elements in
the choice declaration

<choice>
    <element name="A" type="string" minOccurs="1"
maxOccurs="1"/>
    <element name="B" type="int" minOccurs="1"
maxOccurs="1"/>
</choice>

I hope this helps.

David

--- Neil Archer <neil.archer@viewgate.com> escribió: >
Hi,
> 
> I have been trying to convert some DTD's we are
> using to the equivalent XML
> schema, but I cannot find a way to reflect the DTD
> OR which states that one
> or the other element only can be specified.
> 
> i.e. if a document could contain an element A or an
> element B but not both
> the DTD would state something like:
> 
> <!ELEMENT document((A|B))>
> 
> Can anyone help by suggesting how I can show this in
> an XML schema?  Please
> forgive me if there is an obvious answer to this but
> I'm new to using
> schemas and cant see a simple solution.
> 
> Cheers,
> Neil.
> 


_________________________________________________________
Do You Yahoo!?
Obtenga su dirección de correo-e gratis @yahoo.com
en http://correo.espanol.yahoo.com
Received on Tuesday, 5 September 2000 12:02:12 GMT

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