Created
February 24, 2015 11:29
-
-
Save danielestevez/3faf8b023c478bc9064d to your computer and use it in GitHub Desktop.
Print an org.w3c.dom.Document in console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void printXML(final Document responseDoc) throws Exception | |
{ | |
DOMSource domSource = new DOMSource(responseDoc); | |
StringWriter stringWriter = new StringWriter(); | |
StreamResult streamResult = new StreamResult(stringWriter); | |
TransformerFactory transformerFactory = TransformerFactory.newInstance(); | |
Transformer transformer; | |
transformer = transformerFactory.newTransformer(); | |
transformer.transform(domSource, streamResult); | |
System.out.println(stringWriter.toString()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment