为什么 Jing 没有为 XInclude 选择 xml:id?
给定以下文件
a.rnc:
start = a
a = element a { b }
b = element b {
attribute xml:id { xsd:ID }?,
attribute xml:base { xsd:ID }?,
empty
}
a.xml:
<a xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="b.xml" xpointer="element(bid)"/>
</a>
b.xml:
<a><b xml:id="bid"/></a>
会报告
a.xml:1:97: warning: Include operation failed, reverting to fallback. Resource error reading file as XML (href='b.xml'). Reason: XPointer resolution unsuccessful.
a.xml:1:97: fatal: An 'include' failed, and no 'fallback' element was found.
为什么 Jing在运行时
java -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration -jar jing.jar -c a.rnc a.xml
?
如果我将 xpointer 属性更改为 element(/1/1)
它就会通过。
这是Jing的20091111,xercesImpl.jar与jing.jar在同一目录中。
Given the following files
a.rnc:
start = a
a = element a { b }
b = element b {
attribute xml:id { xsd:ID }?,
attribute xml:base { xsd:ID }?,
empty
}
a.xml:
<a xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="b.xml" xpointer="element(bid)"/>
</a>
b.xml:
<a><b xml:id="bid"/></a>
Why is Jing reporting
a.xml:1:97: warning: Include operation failed, reverting to fallback. Resource error reading file as XML (href='b.xml'). Reason: XPointer resolution unsuccessful.
a.xml:1:97: fatal: An 'include' failed, and no 'fallback' element was found.
when run as
java -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration -jar jing.jar -c a.rnc a.xml
?
If I change the xpointer attribute to element(/1/1)
it passes.
This is with the 20091111 of Jing with xercesImpl.jar in the same directory as jing.jar.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,Xerces 不支持 xml:id,从而使这成为可能。更详细的解释请参见rng-users 邮件列表 。
It turns out that Xerces doesn’t support xml:id in a way that makes this possible. A more detailed explanation is available on the rng-users mailing list.