Java tutorial
//package com.java2s; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; public class Main { public static String writeXMLToFile(String resString, String fileName) { try { BufferedWriter writer = new BufferedWriter(new FileWriter(new File(fileName))); writer.write(resString); writer.close(); } catch (IOException e) { e.printStackTrace(); return null; } return fileName; } }