from OutputStream to a File Stream
- by Gabriele
I want to save my DOM Document as an XML file.
I follow this tutorial: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPXSLT4.html
So, this is my code:
...
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(System.out);
transformer.transform(source, result);
but instead of System.out, I want to save in a file the result. How can I do this?