Hi,
I am having a problem with System.out in that after I assign it to the XMLWriter as in the famous pretty print example given in the quick start guide, it prints on the very first occasion of being called but no longer prints after that. I even tried sticking System.out.println("...") statements in other parts of the code after the aassignment and one print had been carried out and nothing was displayed on the screen.

The code for the function I am calling is as follows (note I first write to disk then write to the screen in the code. The section of code I am concerned with is the second one):

public void writeToDisk() throws IOException
{
       // Write the document content to disk
try
                {
                        FileWriter xmlDiskFileWriter = new FileWriter(location+
                                                                                
                                  fileName+
                                                                                
                                  XDIMEHD_FILE_EXT);
                        // Write the document to disk
                        OutputFormat diskOutFormat = 
OutputFormat.createPrettyPrint();
                        XMLWriter xmlDiskWriter = new 
XMLWriter(xmlDiskFileWriter,
                                                                                
                        diskOutFormat);
                        xmlDiskWriter.write(content);
                        xmlDiskWriter.close();

                        // Pretty print the document to System.out
                        OutputFormat screenOutFormat = 
OutputFormat.createPrettyPrint();
                        XMLWriter xmlScreenWriter = new XMLWriter(System.out, 
screenOutFormat);

                        xmlScreenWriter.write("Why cant I write to the screen");
                        System.out.println("why cant i write to the screen");
                        xmlScreenWriter.write(content);
                        xmlScreenWriter.close();
                }
                catch (IOException ioException)
                {
System.out.println("XDIMEHD_Document.writeToDisk: "+ioException.getMessage());
                        throw ioException;
                }
        }
}




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to