public void save ( Writer writer , boolean header , boolean flush ) throws IOException { final PrintWriter out = new PrintWriter ( new BufferedWriter ( writer ) ) ; try { if ( header ) { out . println ( "<?xml version='1.0' encoding='UTF-8'?>" ) ; } toStringRep ( "" , new XAppender ( ) { @ Override public XAppender append ( Object o ) { out . print ( o ) ; return this ; } } ) ; } finally { if ( flush ) { out . flush ( ) ; } } }
Save this XML into the supplied output writer .