StringWriter stringOut = new StringWriter(); // Writer will be a String
XMLSerializer serial = new XMLSerializer(stringOut, format);
SAXEventAdapter adapter = new SAXEventAdapter(serial.asContentHandler(), ignorableTokens, false);
adapter.enableLogging(new AntLogger(this, msgLevel));
queue.fireEvents(adapter);
FileOutputStream outputstream = new FileOutputStream(outFile);
PrintWriter printstream = new PrintWriter(outputstream);