Java tutorial
//package com.java2s; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static boolean writeXMLFile(String outFileName, String xmlFile) { BufferedWriter writer; try { writer = new BufferedWriter(new FileWriter(outFileName, false)); writer.write(xmlFile); writer.close(); return true; } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); return false; } } }