1
我遇到了Xinclude或实体包含文件的问题。我需要知道,解析器包含哪些文件。示例:Java和XML:如何获取包含文件的列表
<?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>解析器成功创建DOM,但如何获取包含的文件名?元素
xi:include
已被替换为文件的内容。
你是如何解析XML的?你在使用标准的Java DOM解析吗? – wjans
是的,我喜欢。我创建了一个“DocumentBuilderFactory”实例,然后创建了一个文档构建器实例。文档生成器使用Xerces。 –