Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
I'm having a problem getting the writeClose method to write the close tags. Here's my code:
File testFile = new File("test.xml");
System.out.println("Test file at " + testFile.getAbsolutePath());
FileOutputStream fos = new FileOutputStream(testFile);
XMLWriter testWriter = new XMLWriter(fos);
Element dbElement = DocumentHelper.createElement("DATABASE");
Element rowElement = DocumentHelper.createElement("ROW");
My xml oputput looks like this:
<?xml version="1.0" encoding="UTF-8"?>
Notice there is no </DATABASE> closing tag from the last statement (writeClose()). Anyone know what I'm doing wrong? Why is there no closing tag?
In a previous test program, I was getting the closing tag at the top of the file instead of at the end.
I added a testWriter.flush(); at the end and it works OK now.