Here you can find the source of serializeXML(Node node)
private static String serializeXML(Node node) throws TransformerException
//package com.java2s; /**/*from w ww.jav a 2s. c o m*/ * This file belongs to the BPELUnit utility and Eclipse plugin set. See enclosed * license file for more information. * */ import java.io.ByteArrayOutputStream; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Node; public class Main { private static String serializeXML(Node node) throws TransformerException { TransformerFactory tf = TransformerFactory.newInstance(); Transformer t = tf.newTransformer(); t.setOutputProperty(OutputKeys.INDENT, "yes"); t.setOutputProperty(OutputKeys.METHOD, "xml"); ByteArrayOutputStream bOS = new ByteArrayOutputStream(); t.transform(new DOMSource(node), new StreamResult(bOS)); return bOS.toString(); } }