- From: Wouter Cordewiner <wouter_cordewiner@hotmail.com>
- Date: Tue, 19 Jun 2001 15:57:23 +0200
- To: xmlschema-dev@w3.org
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?)*)> I created following schema file: <?xml version="1.0" encoding="UTF-8" ?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="qualified" > <xsd:element name="result" > <xsd:complexType mixed="false" > <xsd:sequence> <xsd:sequence minOccurs="0" maxOccurs="unbounded"> <xsd:element name="level4" type="Type1" minOccurs="0" maxOccurs="1" /> </xsd:sequence> <xsd:sequence minOccurs="0" maxOccurs="unbounded"> <xsd:element name="level5" type="Type2" minOccurs="0" maxOccurs="1" /> </xsd:sequence> <xsd:sequence minOccurs="0" maxOccurs="unbounded"> <xsd:element name="level4" type="Type1" minOccurs="0" maxOccurs="1" /> </xsd:sequence> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="Type2" mixed="false" > <xsd:attribute name="id2" > <xsd:simpleType> <xsd:restriction base="xsd:int" /> </xsd:simpleType> </xsd:attribute> </xsd:complexType> <xsd:complexType name="Type1" mixed="false" > <xsd:attribute name="id1" > <xsd:simpleType> <xsd:restriction base="xsd:int" /> </xsd:simpleType> </xsd:attribute> </xsd:complexType> </xsd:schema> From the Xerces-J 1.4.0 parser I get a cos-nonambig error (IBM's Schema Quality Checker gives a similar error). Any suggestions on how to describe this in XML Schema ? Thank you, Wouter Cordewiner _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Received on Tuesday, 19 June 2001 09:57:54 UTC