List of utility methods to do XML Node Transform
String | render(final Node node) render try { final StringWriter writer = new StringWriter(); final DOMSource domSource = new DOMSource(node); final StreamResult streamResult = new StreamResult(writer); final TransformerFactory tf = TransformerFactory.newInstance(); final Transformer serializer = tf.newTransformer(); serializer.setOutputProperty(OutputKeys.INDENT, "yes"); serializer.transform(domSource, streamResult); ... |
String | renderNode(final Node node, final boolean stripHeader) Renders an XML node to a string if (node == null) return null; try { StringWriter writer = new StringWriter(); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.transform(new DOMSource(node), new StreamResult(writer)); final String s = writer.toString(); if (stripHeader) { ... |
String | renderNode(Node node) Renders an XML node to a string if (node == null) return null; try { StringWriter writer = new StringWriter(); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.transform(new DOMSource(node), new StreamResult(writer)); return writer.toString(); } catch (Throwable e) { ... |
void | save(Node node, OutputStream out) save TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(); DOMSource source = new DOMSource(node); StreamResult result = new StreamResult(out); transformer.transform(source, result); |
void | write(final Node node, final Result result) write try { final Source source = new DOMSource(node); final Transformer xformer = TransformerFactory.newInstance().newTransformer(); xformer.transform(source, result); } catch (final TransformerConfigurationException e) { } catch (final TransformerException e) { |