XML 模式唯一粒子属性约束
有谁知道 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< /a>":元数据和"http://www.w3.org/ns/SMIL ":元数据(或元素 来自他们的替换组)违反了“唯一粒子归因”。在针对此模式进行验证期间,存在歧义 将为这两个粒子创建。
该模式是使用 trang 从 SMIL 3.0 DTD 生成的。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果验证遇到 smil:metadata 元素,它无法知道它是否与外部序列的第一个选择部分或第二个选择部分匹配。 XML Schema 不允许这种歧义。
请参阅 XML 模式建议书第 1 部分的附录 H。
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.