Here you can find the source of serializeDom(Node domElement)
public static String serializeDom(Node domElement)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.ls.DOMImplementationLS; import org.w3c.dom.ls.LSSerializer; public class Main { public static String serializeDom(Node domElement) { Document document = domElement.getOwnerDocument(); DOMImplementationLS domImplLS = (DOMImplementationLS) document.getImplementation(); LSSerializer serializer = domImplLS.createLSSerializer(); // by default its true, so set it to omit printing xml-declaration serializer.getDomConfig().setParameter("xml-declaration", false); return serializer.writeToString(domElement); }//from www . j ava2 s.c o m }