String TO XML

前端之家收集整理的这篇文章主要介绍了String TO XML前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

需要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();

猜你在找的XML相关文章