Java tutorial
//package com.java2s; import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.io.Writer; public class Main { public static void writeXml(String content, String path) { try { File file = new File(path); Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "utf-8")); out.write(content); out.flush(); } catch (Exception e) { e.printStackTrace(); } } }