I googled for this for a while but can’t seem to find it and it should be easy. I want to append a CR to then end of an XML file that I am creating with a Transformer. Is there a way to do this>
I tried the following but this resulted in a blank file?
Transformer xformer = TransformerFactory.newInstance().newTransformer(); xformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, 'file:///ReportWiz.dtd'); xformer.transform(source, result); OutputStream writer = new FileOutputStream(file); Byte b = '\n'; writer.write(b); writer.close();
Simple… just add the append option: