Java tutorial
import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.Writer; public class Main { public static void main(String args[]) throws Exception { String s = "<xmltag atr=value>tag data</xmltag>"; FileWriter fr = new FileWriter(new File("a.txt")); Writer br = new BufferedWriter(fr); br.write(s); br.close(); } }