This has got to be much simpler than it seems. I have a org.w3c.dom.Document in memory. I want to save it as an XML document to a file. This has to be easy. But I can't find it anywhere. HELP?
I was confused by an old Microsoft API which simply had a write method, that saved the XML to file. Here's the right way: OutputFormat fmt = new OutputFormat(); StringWriter sw = new StringWriter (); XMLSerializer serial = new XMLSerializer(sw, fmt); serial.serialize(doc); System.out.println(stringOut.toString());
Cob is sand, clay and sometimes straw. This tiny ad is made of cob: