【发布时间】:2014-09-01 21:34:25
【问题描述】:
有谁知道 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报错如下:
[ERROR] cos-nonambig: "http://www.w3.org/ns/SMIL":metadata 和 "http://www.w3.org/ns/SMIL":metadata (或元素 来自他们的替换组)违反“唯一粒子属性”。在针对此模式进行验证期间,歧义 将为这两个粒子创建。
架构是使用 trang 从 SMIL 3.0 DTD 生成的。
【问题讨论】:
-
Trang 并不总是完美的,XSD 也有一些限制 :( 你能发布原始 DTD 的相关部分吗?我知道为什么会出现错误,但原版可能很方便解决它!