private void GetXMLDocument(Document doc) { OutputFormat format1 = new OutputFormat(" ", true); format1.setEncoding("UTF-8"); XMLWriter out1=new XMLWriter(new PrintWriter(System.out),format1); try { out1.write(doc); out1.flush(); } catch (IOException e) { e.printStackTrace(); } }