Xerces cos-nonambig schema validation error
Posted: Thu Jul 07, 2011 4:26 pm
I'm struggling with an error message when validating an XSD. So I implemented an easy example of the same issue using DTD, which works fine.
Here's the DTD:
Converting this DTD to XSD (using Oxygen's "Generate/Convert Schema" function) results in this XSD:
This XSD does not validate. The error given is as follows:
Here's the DTD:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT ParaType1 (#PCDATA) >
<!ELEMENT ParaType2 (#PCDATA) >
<!ELEMENT List (ListItem+) >
<!ELEMENT ListItem ((ParaType1 | List)+ | (ParaType2 | List)+) >
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="ParaType1" type="xs:string"/>
<xs:element name="ParaType2" type="xs:string"/>
<xs:element name="List">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="ListItem"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ListItem">
<xs:complexType>
<xs:choice>
<xs:choice maxOccurs="unbounded">
<xs:element ref="ParaType1"/>
<xs:element ref="List"/>
</xs:choice>
<xs:choice maxOccurs="unbounded">
<xs:element ref="ParaType2"/>
<xs:element ref="List"/>
</xs:choice>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
I don't understand why something as easy as (A | C)+ | (B | C)+ should produce an error. But I'm new to XSD so I hope there's just some trivial change needed. I would appreciate help on this matter.E [Xerces] cos-nonambig: List and List (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.