public String xmlToString(Document doc) { String xml; XMLOutputter out = new XMLOutputter(Format.getPrettyFormat()); xml = out.outputString(doc); return xml; }