try { File xmlFile = new File("c:\\tempmyXML.xml"); dom.saveAs(xmlFile); } catch (ValidationException e) { e.printStackTrace(); }