1

I have problem with by Xinclude or as an entity included files. I need to know, which files have been included by parser. Example:

<?xml version="1.0" ?>
<!DOCTYPE docBookChapter [
    <!ENTITY externalFile SYSTEM "entityIncluded.xml">
]>
<chapter xmlns="http://www.w3.org/1999/xhtml"
xmlns:xi="http://www.w3.org/2001/XInclude">
    <title>Third chapter</title>
    <xi:include href="xIncluded.xml"/>
    <chapter>
        &externalFile;</chapter>
</chapter>
The parser creates DOM successfully, but how to get names of files included? The element xi:include is already replaced with content of file.

4

1 に答える 1

1

拡張DefaultHandlerとメソッド@OverwriteresolveEntity実装では、publicId / systemIdを印刷またはログに記録して返すだけなnullので、SAXParserはデフォルトの動作を使用してエンティティを解決します。

DefaultHandlerサブクラスをSAXParserコンストラクターで渡します。

于 2011-07-11T07:43:48.320 に答える