Re: [xml-dev] DTD vs XSD: No Duplicate Types in (Mixed) Content Models

From
Fourny Ghislain <>
To
Maik Stührenberg <>
Date
2011-01-31T15:04:27Z
ID
<>
Thread
Re: [xml-dev] DTD vs XSD: No Duplicate Types in (Mixed) Content Models
Hello Maik,

I think XSD processors make a difference because of the Unique Particle Attribution Constraint, mentioned in the XML Schema specification:
http://www.w3.org/TR/xmlschema-1/#cos-nonambig
"A content model must be formed such that [...] the particle component contained [...] therein with which to attempt to validate each item in the sequence in turn can be uniquely determined [...] without any information about the items in the remainder of the sequence."

Your example corresponds to what is said in the non-normative part H:
http://www.w3.org/TR/xmlschema-1/#non-ambig
"A content model will violate the unique attribution constraint if it contains two particles which overlap and which [...] may validate adjacent information items and the first has {min occurs} less than {max occurs}."

The last two xs:element particles in your first example (below) seem to fulfill this criterion.

I hope this helps?

Kind regards,
Ghislain


On Jan 31, 2011, at 3:27 PM, Maik Stührenberg wrote:

> It would be interesting to know why XSD processors do make a difference 
> between
> 
> <xs:element name="a">
>     <xs:complexType>
>       <xs:sequence>
>         <xs:element ref="b"/>
>         <xs:element ref="b"/>
>         <xs:element ref="b"/>
>         <xs:element ref="b" minOccurs="0" maxOccurs="1"/>
>         <xs:element ref="b" minOccurs="0" maxOccurs="1"/>
>       </xs:sequence>
>     </xs:complexType>
>   </xs:element>
> 
> and
> 
> <xs:element name="a">
>     <xs:complexType>
>       <xs:sequence>
>         <xs:element ref="b" minOccurs="3" maxOccurs="5"/>
>       </xs:sequence>
>     </xs:complexType>
>   </xs:element>