/** * Serializes the given node. */ public String printNode(Node n) { try { Writer writer = new StringWriter(); DOMUtilities.writeNode(n, writer); writer.close(); return writer.toString(); } catch (IOException ex) { throw new RuntimeException(ex); } }
/** * Serializes the given node. */ public String printNode(Node n) { try { Writer writer = new StringWriter(); DOMUtilities.writeNode(n, writer); writer.close(); return writer.toString(); } catch (IOException ex) { throw new RuntimeException(ex); } }
/** * Serializes the given node. */ public String printNode(Node n) { try { Writer writer = new StringWriter(); DOMUtilities.writeNode(n, writer); writer.close(); return writer.toString(); } catch (IOException ex) { throw new RuntimeException(ex); } }
/** * Serializes the given DOM node using {@link #writeNode(Node,Writer)} * and returns the XML as a String. * * @param n The Node to serialize. * @return A String containing the XML serialization of the Node, or an * empty String if there was a problem during serialization. */ public static String getXML(Node n) { Writer writer = new StringWriter(); try { DOMUtilities.writeNode(n, writer); writer.close(); } catch (IOException ex) { return ""; } return writer.toString(); }
/** * Serializes the given DOM node using {@link #writeNode(Node,Writer)} * and returns the XML as a String. * * @param n The Node to serialize. * @return A String containing the XML serialization of the Node, or an * empty String if there was a problem during serialization. */ public static String getXML(Node n) { Writer writer = new StringWriter(); try { DOMUtilities.writeNode(n, writer); writer.close(); } catch (IOException ex) { return ""; } return writer.toString(); }
/** * Serializes the given DOM node using {@link #writeNode(Node,Writer)} * and returns the XML as a String. * * @param n The Node to serialize. * @return A String containing the XML serialization of the Node, or an * empty String if there was a problem during serialization. */ public static String getXML(Node n) { Writer writer = new StringWriter(); try { DOMUtilities.writeNode(n, writer); writer.close(); } catch (IOException ex) { return ""; } return writer.toString(); }
/** * Serializes the specified <code>Document</code>, writing it to the given * <code>Writer</code>. */ public static void writeDocument(Document doc, Writer w) throws IOException { AbstractDocument d = (AbstractDocument) doc; if (doc.getDocumentElement() == null) { throw new IOException("No document element"); } NSMap m = NSMap.create(); for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) { writeNode(n, w, m, "1.1".equals(d.getXmlVersion())); } }
/** * Writes a node using the given writer. */ public static void writeNode(Node n, Writer w) throws IOException { if (n.getNodeType() == Node.DOCUMENT_NODE) { writeDocument((Document) n, w); } else { AbstractDocument d = (AbstractDocument) n.getOwnerDocument(); writeNode(n, w, NSMap.create(), d == null ? false : "1.1".equals(d.getXmlVersion())); } }
/** * Serializes the specified <code>Document</code>, writing it to the given * <code>Writer</code>. */ public static void writeDocument(Document doc, Writer w) throws IOException { AbstractDocument d = (AbstractDocument) doc; if (doc.getDocumentElement() == null) { throw new IOException("No document element"); } NSMap m = NSMap.create(); for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) { writeNode(n, w, m, "1.1".equals(d.getXmlVersion())); } }
/** * Serializes the specified <code>Document</code>, writing it to the given * <code>Writer</code>. */ public static void writeDocument(Document doc, Writer w) throws IOException { AbstractDocument d = (AbstractDocument) doc; if (doc.getDocumentElement() == null) { throw new IOException("No document element"); } NSMap m = NSMap.create(); for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) { writeNode(n, w, m, "1.1".equals(d.getXmlVersion())); } }
/** * Writes a node using the given writer. */ public static void writeNode(Node n, Writer w) throws IOException { if (n.getNodeType() == Node.DOCUMENT_NODE) { writeDocument((Document) n, w); } else { AbstractDocument d = (AbstractDocument) n.getOwnerDocument(); writeNode(n, w, NSMap.create(), d == null ? false : "1.1".equals(d.getXmlVersion())); } }
/** * Writes a node using the given writer. */ public static void writeNode(Node n, Writer w) throws IOException { if (n.getNodeType() == Node.DOCUMENT_NODE) { writeDocument((Document) n, w); } else { AbstractDocument d = (AbstractDocument) n.getOwnerDocument(); writeNode(n, w, NSMap.create(), d == null ? false : "1.1".equals(d.getXmlVersion())); } }
w.write('>'); do { writeNode(c, w, m, isXML11); c = c.getNextSibling(); } while (c != null);
w.write('>'); do { writeNode(c, w, m, isXML11); c = c.getNextSibling(); } while (c != null);
w.write('>'); do { writeNode(c, w, m, isXML11); c = c.getNextSibling(); } while (c != null);