質問
Apache Xerces 3.0.1 Xincludeを使用しています。 XINCLUDEメカニズムを使用してXMLファイルを含めたいと思います。同じディレクトリに3つのXMLファイルがあります。 test_a.xml xincludes test_b.xmlはtest_c.xmlをxincludeします。 test_a.xml xinclude test_b.xmlを持っているとき、それは機能します。ただし、test_b.xml xinclude test_c.xmlがある場合、次のコマンドラインエラーが発生します。
c: digital_receiver test> xinclude.exe test_a.xml test_z.xml parse test_a.xml進行中...ファイルC: digital_receiver test/test_a.xmlでの致命的なエラーURIで終了しました。
test_a.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<test_a xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="test_b.xml"/>
</test_a>
test_b.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<test_b xmlns:xi="http://www.w3.org/2001/XInclude">
<ch>5</ch>
<xi:include href="test_c.xml"/>
</test_b>
test_c:xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<test_c>
<channel>1</channel>
</test_c>
どんな助けも感謝します。
解決
私が知る限り、あなたのXMLは大丈夫ですが、私はこれに関する最後の言葉であると主張しません。
それは私のものです 推測してみて XercesのXinclude Processingでバグにヒットしていること。このコードはほぼ3年前ですが、明らかにそうではなかったことに注意してください Xerces 3.0までリリースされました, 、したがって、比較的テストされていない可能性があります。 (そしてそれを考えると 含まれているドキュメントのベースURI Xincludeで処理されているため、ここでのバグの可能性は0より大きいように見えます。
回避策として、エラーメッセージが示唆していることを行うことをお勧めします。付属のファイルのURIにスキームを追加します。残念ながら、ファイルURIの場合、それはまた、絶対的なURIを使用する必要があることを意味します。
test_a.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<test_a xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="file://path/to/directory/test_b.xml"/>
</test_a>
test_b.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<test_b xmlns:xi="http://www.w3.org/2001/XInclude">
<ch>5</ch>
<xi:include href="file://path/to/directory/test_c.xml"/>
</test_b>
更新:確かにあります 同様のバグ apache.orgで。 (私はそれが同じ問題を説明していると思いますが、レポートの文言はそれを 独身 相対パスを使用すると、包含の層が失敗します。)