有谁知道 xml 模式中所谓的“唯一粒子属性”约束,以及为什么它可能会被违反:
<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>
运行XJC报错如下:
[错误] cos-nonambig: " http://www.w3.org/ns/SMIL ":metadata 和 " http://www.w3.org/ns/SMIL ":metadata (或它们的替换组中的元素)违反“唯一粒子归属”。在针对此模式进行验证期间,将为这两个粒子创建歧义。
该模式是使用 trang 从 SMIL 3.0 DTD 生成的。