I had the same problem a while back and I had to use the following:
Code:
public void writeXML(String xml) throws Exception {
OutputStream os = new BufferedOutputStream(new FileOutputStream("file.xml"));
String format = "UTF-8";
OutputStreamWriter osw = new OutputStreamWriter(os,format);
osw.write(xml);
osw.flush();
os.close();
osw.close();
}
You have to use a writer that you can set to an XML standard for it to format correctly and be recognized as XML. Just being able to "see" the tags and valid XML doesn't mean that the file is actually formatted correctly.
Bookmarks