XML Schema Unique Particle Attribution Constraint
Does anyone know anything about the so called "Unique Particle Attribution" constraint in xml schema and why it might be violated by this:
<xs:complexType name="SMIL.switch.content">
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="smil:metadata"/>
<xs:element ref="SMIL.switch-control"/>
</xs:choice>
<xs:choice>
<xs:choice>
<xs:sequence maxOccurs="unbounded">
<xs:choice maxOccurs="unbounded">
<xs:element ref="SMIL.timecontainer.class"/>
<xs:element ref="SMIL.media-object"/>
</xs:choice>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="smil:metadata"/>开发者_运维技巧;
<xs:element ref="SMIL.switch-control"/>
</xs:choice>
</xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="smil:metadata"/>
<xs:element ref="SMIL.switch-control"/>
</xs:choice>
</xs:choice>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="smil:layout"/>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="smil:metadata"/>
<xs:element ref="SMIL.switch-control"/>
</xs:choice>
</xs:sequence>
</xs:choice>
</xs:sequence>
</xs:complexType>
The error from running XJC is as follows:
[ERROR] cos-nonambig: "http://www.w3.org/ns/SMIL":metadata and "http://www.w3.org/ns/SMIL":metadata (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.
The schema is generated from the SMIL 3.0 DTD using trang.
If validation would encounter a smil:metadata element, it cannot know whether this matches the first choice part or the second choice part of the outer sequence. And XML Schema does not allow this ambiguity.
See appendix H of the XML Schema Recommendation, part 1.
精彩评论