如何使用 xml 模式重新定义 xhtml body 元素?
这是我的第一个问题,已经得到解答:XML 架构 - 是否可以在整个文档中仅允许某个元素出现一次?
现在我想重新定义 xhtml 的 body
元素并为其添加唯一约束。这是我的 redefine.xsd
中的 xhtml-struct-1.xsd
内的定义,
<xs:group
name="xhtml.html.content">
<xs:sequence>
<xs:element
name="head"
type="xhtml.head.type"/>
<xs:element
name="body"
type="xhtml.body.type"/>
</xs:sequence>
</xs:group>
我尝试了以下操作:
<xs:redefine schemaLocation="http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd">
<xs:group name="xhtml.html.content">
<xs:sequence>
<xs:element name="head" type="xhtml.head.type" />
<xs:element name="body" type="xhtml.body.type" >
<xs:unique name="highlander">
<xs:selector xpath=".//mylang:content"/>
<xs:field xpath="."/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:group>
</xs:redefine>
org.xml.sax.SAXParseException;系统ID: 文件:xhtml-struct-1.xsd; 行号:113;列数:35; mg-props- Correct.2:圆形 检测到组“:xhtml.html.content_fn3dktizrknc9pi”的定义。 递归地跟踪粒子的 {term} 值会导致 其 {term} 是群本身的粒子。
我尝试了许多其他变体,但总是遇到我不明白的奇怪错误。如何使用 XML 架构重新定义 xhtml body 元素?
This was my first question, which was answered already: XML Schema - Is it possible to allow a certain element only once in the whole document?
Now I want to redefine body
element of xhtml and add a unique constraint to it. This is the definition inside xhtml-struct-1.xsd
<xs:group
name="xhtml.html.content">
<xs:sequence>
<xs:element
name="head"
type="xhtml.head.type"/>
<xs:element
name="body"
type="xhtml.body.type"/>
</xs:sequence>
</xs:group>
in my redefine.xsd
I tried this:
<xs:redefine schemaLocation="http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd">
<xs:group name="xhtml.html.content">
<xs:sequence>
<xs:element name="head" type="xhtml.head.type" />
<xs:element name="body" type="xhtml.body.type" >
<xs:unique name="highlander">
<xs:selector xpath=".//mylang:content"/>
<xs:field xpath="."/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:group>
</xs:redefine>
org.xml.sax.SAXParseException; systemId:
file:xhtml-struct-1.xsd;
lineNumber: 113; columnNumber: 35; mg-props-correct.2: Circular
definitions detected for group ':xhtml.html.content_fn3dktizrknc9pi'.
Recursively following the {term} values of the particles leads to a
particle whose {term} is the group itself.
I treid dozens of other variants but I always get strange errors which i don't understand. How can I redefine a xhtml body element with XML Schema?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
重新定义群体的工作方式有所不同。
看起来您想重新定义类型“xhtml.body.type”,您应该尝试这样做,而不是重新定义组“xhtml.html.content”。
也许这些片段有帮助:
http://www.datypic.com/books/defxmlschema/chapter18。 html
Redefining groups is working differently.
It looks like you want to redefine type "xhtml.body.type" and you should try to do that instead of redefining group "xhtml.html.content".
Maybe these snippets help:
http://www.datypic.com/books/defxmlschema/chapter18.html
您是否尝试过不同的解析器/验证器?
关于我在 W3C 的 XMLSchema Dev 邮件列表 有一个私人响应(因此在之前链接的存档中不可用)告诉我有关响应者运行不同解析器并产生不同结果的测试:libxml v20708 和 MSXML v20090415 已成功验证,而 Xerces-J 2.11 和 Saxon 9.2 都存在 XSD 问题。
Have you tried different parsers/validators?
Regarding my somewhat similar issue as posted on W3C's XMLSchema Dev Mailing List there was a private response (thus not available in archive linked before) telling me about responder's tests running different parsers with different results: libxml v20708 and MSXML v20090415 successfully validated while Xerces-J 2.11 and Saxon 9.2 both had issues with the XSD.