public static void writeDocumentToFile(String outFilePath, Document document) throws IOException {
OutputFormat format = OutputFormat.createPrettyPrint();
format.setNewLineAfterDeclaration(false);//去除第二行空白行
XMLWriter xmlWriter3 = new XMLWriter(new FileWriter(outFilePath),format);
xmlWriter3.write(document);
xmlWriter3.flush();
xmlWriter3.close();
}
将document写入到指定文件中
最新推荐文章于 2023-06-30 23:28:09 发布