Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TransformerFactory transformerFactory = TransformerFactory.newInstance();
- Transformer transformer = transformerFactory.newTransformer();
- transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
- transformer.setOutputProperty(OutputKeys.METHOD, "xml");
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
- DOMSource source = new DOMSource(doc);
- StreamResult console = new StreamResult(sw);
- transformer.transform(source, console);
- <root element is displayed>
- <Empty string is displayed>
Add Comment
Please, Sign In to add comment