OutputFormat format = OutputFormat.createPrettyPrint();
format.setEncoding("GBK");
XMLWriter writer = new XMLWriter((new OutputStreamWriter(new FileOutputStream(fileName),"UTF-8")),format);
writer.write(document);
writer.close();
OutputFormat format = OutputFormat.createPrettyPrint();
format.setEncoding("GBK");
XMLWriter writer = new XMLWriter((new OutputStreamWriter(new FileOutputStream(fileName),"UTF-8")),format);
writer.write(document);
writer.close();