public static String domToString(Document document) {
		Source source = new DOMSource(document);
		try {
			TransformerFactory factory = TransformerFactory.newInstance();
			Transformer transformer = factory.newTransformer();
			transformer.setOutputProperty(OutputKeys. INDENT, "yes");
			transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "1");
			StringWriter sw=new StringWriter();
            StreamResult resultStream = new StreamResult(sw);
            transformer.transform(source, resultStream);
            return sw.toString();
		} catch (TransformerException e) {
			return e.toString();
		}
	}
public static String domToString(Document document) {
		Source source = new DOMSource(document);
		try {
			TransformerFactory factory = TransformerFactory.newInstance();
			Transformer transformer = factory.newTransformer();
			transformer.setOutputProperty(OutputKeys. INDENT, "yes");
			transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "1");
			StringWriter sw=new StringWriter();
            StreamResult resultStream = new StreamResult(sw);
            transformer.transform(source, resultStream);
            return sw.toString();
		} catch (TransformerException e) {
			return e.toString();
		}
	}
public static string domtostring(document document) { source source = new domsource(document); try { transformerfactory factory = transformerfactory.newinstance(); transformer transformer = factory.newtransformer(); transformer.setoutputproperty(outputkeys. indent, "yes"); transformer.setoutputproperty("{http://xml.apache.org/xslt}indent-amount", "1"); stringwriter sw=new stringwriter(); streamresult resultstream = new streamresult(sw); transformer.transform(source, resultstream); return sw.tostring(); } catch (transformerexception e) { return e.tostring(); } }