List of utility methods to do XML Node Serialize
String | serializeXML(Node node) serialize XML TransformerFactory tf = TransformerFactory.newInstance(); Transformer t = tf.newTransformer(); t.setOutputProperty(OutputKeys.INDENT, "yes"); t.setOutputProperty(OutputKeys.METHOD, "xml"); ByteArrayOutputStream bOS = new ByteArrayOutputStream(); t.transform(new DOMSource(node), new StreamResult(bOS)); return bOS.toString(); |
String | serializeXML(Node root) This method serializes the supplied XML. if (root == null) return "<null/>"; if (root.getFeature("Core", "3.0") == null) throw new UnsupportedOperationException("JVM doesn't support DOM Core 3.0"); if (root.getFeature("LS", "3.0") == null) throw new UnsupportedOperationException("JVM doesn't support DOM LS 3.0"); DOMImplementationLS ls = (DOMImplementationLS) (root.getOwnerDocument().getImplementation()) .getFeature("LS", "3.0"); ... |
boolean | serializeXmlNode(Node node, Writer writer, boolean includeNode) serialize Xml Node if (node == null) { return false; short type = node.getNodeType(); boolean result = true; switch (type) { case Node.ATTRIBUTE_NODE: { String text = ((Attr) node).getValue(); ... |