Hi
I'm developing a program that will retrieve data from a db and will need to write it to a xml file.
Actually I'm using an example that someone gave me to write xml to stdout:
TransformerFactory transFact = TransformerFactory.newInstance();
Transformer trans = transFact.newTransformer();
trans.setOutputProperty(OutputKeys.INDENT, "yes");
StringWriter sw = new StringWriter();
Result result = new StreamResult(sw);
try {
trans.transform(new DOMSource(doc), result);
} catch (TransformerException te) {
System.out.println(te.getMessageAndLocation());
throw te;
}
System.out.println(sw.toString());
How could I write this to a file ?
Thanks in advance
<xl>