Mozda ti ovo pomogne:
Code:
public void serializeToXML(Document documentXML) throws Exception
{
OutputFormat outformat = OutputFormat.createPrettyPrint();
outformat.setEncoding("Windows-1250");
XMLWriter writer = new XMLWriter(new FileOutputStream("imefajla.xml"), outformat);
writer.write(documentXML);
writer.flush();
}
Koristis dom4j. Vidi na njihovom sajtu na stranici
http://www.dom4j.org/guide.html