Guest User

Untitled

a guest
May 23rd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. TransformerFactory transformerFactory = TransformerFactory.newInstance();
  2. Transformer transformer = transformerFactory.newTransformer();
  3. transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
  4. transformer.setOutputProperty(OutputKeys.METHOD, "xml");
  5. transformer.setOutputProperty(OutputKeys.INDENT, "yes");
  6. transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
  7. DOMSource source = new DOMSource(doc);
  8. StreamResult console = new StreamResult(sw);
  9. transformer.transform(source, console);
  10.  
  11. <root element is displayed>
  12.  
  13. <Empty string is displayed>
Add Comment
Please, Sign In to add comment