Here you can find the source of printNodeToConsole(Node n, ByteArrayOutputStream byteArrayOS)
public static void printNodeToConsole(Node n, ByteArrayOutputStream byteArrayOS)
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayOutputStream; import java.util.Properties; import javax.xml.soap.Node; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; public class Main { public static void printNodeToConsole(Node n, ByteArrayOutputStream byteArrayOS) { try {//from ww w . j a v a 2s .co m TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); Properties oform = new Properties(); oform.setProperty("encoding", "ISO-8859-1"); //oform.setOmitXMLDeclaration(true); transformer.setOutputProperties(oform); // also print to console transformer.transform(new DOMSource(n), new StreamResult( byteArrayOS)); } catch (Exception e) { System.out.println(e); } } }