OutputFormat format = OutputFormat.createPrettyPrint();//缩减型格式
//OutputFormat format = OutputFormat.createCompactFormat();//紧凑型格式
format.setEncoding("gb2312");//设置编码
//format.setTrimText(false);//设置text中是否要删除其中多余的空格
XMLWriter xw = new XMLWriter(fw, format);
xw.write(doc);
XMLOutputter xmlOut = new XMLOutputter(Format.getPrettyFormat());
properties.setProperty(""{http://xml.apache.org/xslt}indent-amount"", "4");
xformer.setOutputProperty(""{http://xml.apache.org/xslt}indent-amount"", "4");