更新时间:2023-09-11 21:53:40
您是否尝试过不同的解析器/验证器?
关于我在 W3C 的 XMLSchema Dev Mailing 上发布的有点类似的问题List 有一个私人回复(因此在之前链接的存档中不可用)告诉我响应者的测试运行不同的解析器,结果不同:libxml v20708 和 MSXML v20090415 成功验证,而 Xerces-J 2.11 和 Saxon 9.2 都有问题XSD.
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?
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.