且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

创建XML只打印到一行

更新时间:2023-12-04 10:48:28

我使用

Transformer tf = TransformerFactory.newInstance().newTransformer();
tf.setOutputProperty(OutputKeys.INDENT, "yes");
tf.setOutputProperty(OutputKeys.METHOD, "xml");
tf.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");

哪个似乎很正常。