Here you can find the source of getStringFromDoc(org.w3c.dom.Document doc)
Parameter | Description |
---|---|
doc | a parameter |
public static final String getStringFromDoc(org.w3c.dom.Document doc)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.ls.DOMImplementationLS; import org.w3c.dom.ls.LSSerializer; public class Main { /**//from w ww . j a v a2s .co m * Prints a DOM document to XML using DOM Load and Save's LSSerializer. * * @param doc * @return xml output * @see LSSerializer */ public static final String getStringFromDoc(org.w3c.dom.Document doc) { DOMImplementationLS domImplementation = (DOMImplementationLS) doc.getImplementation(); LSSerializer lsSerializer = domImplementation.createLSSerializer(); return lsSerializer.writeToString(doc); } }