views:

43

answers:

2
public static void writeXmlFile(Document doc, String filename) {
     try {
           // Prepare the DOM document for writing
           Source source = new DOMSource(doc);

           // Prepare the output file
           File file = new File(filename);
           Result result = new StreamResult(file);

           // Write the DOM document to the file

           Transformer xformer = TransformerFactory.newInstance()
                              .newTransformer();
           xformer.transform(source, result);

     } catch (TransformerConfigurationException e) {
     } catch (TransformerException e) {
     }
}

i am using this function to write xml into a file, everything comes fine but one line is being added as follows just before last ending tag.

[Mar 13 15:40:16] INFO (ConnectionController.java:342) - 

i am neer using this class and why is this mar 13 date even i dont know

is it a common issue ?

A: 

Can we exclude that the document contains the text already? Because that would be a pretty easy solution: the error wouldn't occur durcing printing but maybe during document generation.

To investigate, you could just iterate over the child nodes of root (not elements) and check whether there is a suspicious text or cdata node near the end.

At least it looks like a log message, generated when the machine system date was set to March, 13 2010.

Andreas_D
@mynameisanthpny - Just being curious - what was the problem?
Andreas_D
A: 

Clearly something else is writing to the same file. Looks like a logger to me.

I hope that isn't your real exception handling.

EJP