Re: Element occurence

>From: ht@cogsci.ed.ac.uk (Henry S. Thompson)
>To: "Wouter Cordewiner" <wouter_cordewiner@hotmail.com>
>CC: xmlschema-dev@w3.org
>Subject: Re: Element occurence
>Date: 20 Jun 2001 14:05:09 +0100
>
>"Wouter Cordewiner" <wouter_cordewiner@hotmail.com> writes:
>
> > I have following XML file:
> >
> > <?xml version="1.0" encoding="UTF-8" ?>
> > <result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:noNamespaceSchemaLocation='schema.xsd'>
> >   <level4 id1='1'></level4>
> >   <level4 id1='2'></level4>
> >   <level4 id1='3'></level4>
> >   <level4 id1='4'></level4>
> >   <level5 id2='1'></level5>
> >   <level5 id2='2'></level5>
> >   <level5 id2='3'></level5>
> >   <level4 id1='1'></level4>
> > </result>
> >
> > All elements under the <result> element should be optional, and they can 
>occur
> > multiple times.
> >
> > In other words, the DTD representation of what I would like to 
>accomplish is :
> >
> >
> > <!ELEMENT result ((level4?)*,(level5?)*,(level4?)*)>
>
>This DTD is also broken -- a validating parser would reject it for
>ambiguity.  If all you want is literally what you say above, the DTD
>would be
>
>   <!ELEMENT result (level4|level5)*>
>
>If you want something more like what you have above, then it's
>
>   <!ELEMENT result (level4*,level5+,level4*)>
>
>The first becomes
>
>  <xs:choice minOccurs="0" maxOccurs="unbounded">
>   <xs:element ref="level4"/>
>   <xs:element ref="level5"/>
>  </xs:choice>
>
>The second becomes
>
>   <xs:sequence>
>    <xs:element ref="level4" minOccurs="0" maxOccurs="unbounded"/>
>    <xs:element ref="level5" minOccurs="1" maxOccurs="unbounded"/>
>    <xs:element ref="level4" minOccurs="0" maxOccurs="unbounded"/>
>   </xs:sequence>
>
>ht
>--
>   Henry S. Thompson, HCRC Language Technology Group, University of 
>Edinburgh
>           W3C Fellow 1999--2001, part-time member of W3C Team
>      2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
>	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
>		     URL: http://www.ltg.ed.ac.uk/~ht/
>

That is correct, thank you.

What I wanted to accomplish was:

<!ELEMENT result (level4*,level5*,level4*)>

The level4 element is completely optional before and after level5, and 
level5 itself is also optional.

Is there any way to express this without any ambiguity ?

Thank you,

Wouter Cordewiner
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Received on Wednesday, 20 June 2001 10:36:33 UTC