我需要从 dom4j 文档类型中删除 XML 声明
我正在创建文档
doc = (Document) DocumentHelper.parseText(someXMLstringWithoutXMLDeclaration);
DocumenHelper 解析为 Document doc 的字符串不包含 XML 声明(它来自 XML => XSL => XML 转换) 我认为 DocumentHelper 正在向文档主体添加声明?
有什么方法可以从
的正文中删除 XML 声明doc
最佳答案
我选择的更简单的解决方案是
doc.getRootElement().asXML();
关于java - 文档中的 dom4j XML 声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5971649/