为什么Jing不为XInclude提取xml:id?

时间:2011-02-26 09:31:30

标签: xml relaxng xinclude jing

给出以下文件

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>

为什么Jing报道

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.

运行时
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相同的目录中。

1 个答案:

答案 0 :(得分:1)

事实证明,Xerces不支持xml:id,这使得这成为可能。有更详细的解释on the rng-users mailing list