- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 20 Jun 2001 14:05:09 +0100
- To: "Wouter Cordewiner" <wouter_cordewiner@hotmail.com>
- Cc: xmlschema-dev@w3.org
"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/
Received on Wednesday, 20 June 2001 09:05:08 UTC