需要dom4j的jar包
Document doc = saxReader.read(new ByteArrayInputStream(fileString.getBytes()));
// Element rootElement = doc.getRootElement();
OutputFormat format = OutputFormat.createPrettyPrint();
format.setEncoding("utf-8");
XMLWriter writer = new XMLWriter(new FileWriter(outFile),format);
writer.write(doc);
writer.close();