格式化 XmlOptions xmlOptions = new XmlOptions();xmlOptions.setSavePrettyPrint();xmlOptions.setSavePrettyPrintIndent(4); hbmDoc.save(file, xmlOptions);