List of utility methods to do XML Node Save
void | save(String filename, Node node) save PrintStream out = null; try { out = new PrintStream(new BufferedOutputStream(new FileOutputStream(filename)), true, "UTF-8"); print(out, node); } catch (Exception ex) { throw new IOException(ex.getLocalizedMessage()); } finally { if (out != null) ... |
ResultSet | toResultSet(Node node, ResultSet rs) to Result Set int type = node.getNodeType(); if (type == Node.ELEMENT_NODE) { NamedNodeMap nnm = node.getAttributes(); String name = node.getNodeName(); String value = ""; Node next = node.getFirstChild(); if (next != null) { type = next.getNodeType(); ... |
void | write(Node node, Writer out) write write(node, out, false); |
void | writeByDom(Node node, Writer writer, int indent) write By Dom try { DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); DOMImplementationLS domImpLS = (DOMImplementationLS) registry.getDOMImplementation("LS 3.0"); LSOutput output = domImpLS.createLSOutput(); output.setCharacterStream(writer); output.setEncoding("utf-8"); LSSerializer serializer = domImpLS.createLSSerializer(); serializer.setNewLine("\n"); ... |
void | writeDescription(PrintWriter out, Node node, String offSet) Parses and writes the description of a given Node into the output stream Node childNodeDescriptive = null; Node childNodeBrief = null; Node childNodeDescription = null; if (node == null) return; childNodeDescriptive = getNodeByName("descriptive", node.getChildNodes()); if (childNodeDescriptive == null) return; ... |
void | writeDOM(Node node, PrintWriter writer) Recursively write the XML DOM representation into a print writer output stream. if (node != null) { switch (node.getNodeType()) { case Node.DOCUMENT_NODE: writer.print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + EOL); DocumentType doctype = ((Document) node).getDoctype(); if (doctype != null) { writer.print("<!DOCTYPE "); writer.print(doctype.getName()); ... |
void | writeNode(Node n, FileOutputStream o) Writes a DOM node (and all its ancestors) to the given output stream PrintWriter w = new PrintWriter(o);
w.print(n.toString());
w.close();
|
void | writeNode(Node n, Writer w) Writes a node using the given writer. switch (n.getNodeType()) { case Node.ELEMENT_NODE: w.write("<"); w.write(n.getNodeName()); if (n.hasAttributes()) { NamedNodeMap attr = n.getAttributes(); int len = attr.getLength(); for (int i = 0; i < len; i++) { ... |
void | writeNode(Node node, OutputStream os, boolean formatted) write Node DOMImplementationRegistry domImplementationRegistry = DOMImplementationRegistry.newInstance(); DOMImplementationLS domImplementationLS = (DOMImplementationLS) domImplementationRegistry .getDOMImplementation("LS"); LSOutput lsOutput = domImplementationLS.createLSOutput(); lsOutput.setEncoding("UTF-8"); lsOutput.setByteStream(os); LSSerializer lsSerializer = domImplementationLS.createLSSerializer(); if (formatted) ... |
void | writeNode(Node node, OutputStream output, Map Writes a Node out to an OutputStream using the DOM, level 3, Load/Save serializer. DOMImplementationLS domImplLS = getLSDOMImpl(node); LSSerializer serializer = getLSSerializer(domImplLS, serializerParams); LSOutput serializerOut = domImplLS.createLSOutput(); serializerOut.setByteStream(output); serializer.write(node, serializerOut); |