Class XmlDataWriter

    • Field Detail

      • LOGGER

        protected static final org.apache.logging.log4j.Logger LOGGER
    • Method Detail

      • getXmlWriter

        public final XmlWriter getXmlWriter()
        Returns:
        The underlying XmlWriter.
      • write

        public void write​(Node node)
                   throws IOException
        Writes a node.
        Parameters:
        node - The node.
        Throws:
        IOException - When an IO error occurs.
      • write

        public static void write​(XmlWriter writer,
                                 Node node,
                                 boolean asDocument)
                          throws IOException
        Writes a node to an XmlWriter.
        Parameters:
        writer - The XmlWriter.
        node - The node.
        asDocument - If true and node is not a document, inserts XML heading <?xml version="1.0" encoding="UTF-8"?> before writing the node.
        If false and node is not a document, directly writes the node.
        If node is a document, this has no effect.
        Throws:
        IOException - When an IO error occurs.
      • write

        public static void write​(XmlWriter writer,
                                 Node node)
                          throws IOException
        Writes a node to an XmlWriter.

        If node is not a document, XML heading <?xml version="1.0" encoding="UTF-8"?> is not inserted.
        Use write(XmlWriter, Node, boolean) for that.

        Parameters:
        writer - The XmlWriter.
        node - The node.
        Throws:
        IOException - When an IO error occurs.
      • print

        public static void print​(Node node,
                                 boolean asDocument,
                                 PrintStream out,
                                 String indent,
                                 boolean close,
                                 XmlWriter.Feature... features)
                          throws IOException
        Prints a Node to a PrintStream.
        Parameters:
        node - The node.
        asDocument - If true and node is not a document, inserts XML heading <?xml version="1.0" encoding="UTF-8"?> before writing the node.
        If false and node is not a document, directly writes the node.
        If node is a document, this has no effect.
        out - The PrintStream.
        indent - Indent string. If not null, pretty printing is enabled.
        close - If true, out is closed in the end.
        features - The XmlWriter features to enable.
        Throws:
        IOException - When an IO error occurs.
      • print

        public static void print​(Document doc,
                                 PrintStream out,
                                 String indent,
                                 boolean close,
                                 XmlWriter.Feature... features)
                          throws IOException
        Prints a Document to a PrintStream.
        Parameters:
        doc - The document.
        out - The PrintStream.
        indent - Indent string. If not null, pretty printing is enabled.
        close - If true, out is closed in the end.
        features - The XmlWriter features to enable.
        Throws:
        IOException - When an IO error occurs.
      • save

        public static void save​(Node node,
                                boolean asDocument,
                                Writer writer,
                                String indent,
                                XmlWriter.Feature... features)
                         throws IOException
        Saves a Node to a Writer.
        Parameters:
        node - The node.
        asDocument - If true and node is not a document, inserts XML heading <?xml version="1.0" encoding="UTF-8"?> before writing the node.
        If false and node is not a document, directly writes the node.
        If node is a document, this has no effect.
        writer - The writer.
        indent - Indent string. If not null, pretty printing is enabled.
        features - The XmlWriter features to enable.
        Throws:
        IOException - When an IO error occurs.
      • save

        public static void save​(Document doc,
                                Writer writer,
                                String indent,
                                XmlWriter.Feature... features)
                         throws IOException
        Saves a Document to a Writer.
        Parameters:
        doc - The document.
        writer - The writer.
        indent - Indent string. If not null, pretty printing is enabled.
        features - The XmlWriter features to enable.
        Throws:
        IOException - When an IO error occurs.
      • save

        public static void save​(Node node,
                                boolean asDocument,
                                OutputStream os,
                                String indent,
                                XmlWriter.Feature... features)
                         throws IOException
        Saves a Node to an OutputStream.
        Parameters:
        node - The node.
        asDocument - If true and node is not a document, inserts XML heading <?xml version="1.0" encoding="UTF-8"?> before writing the node.
        If false and node is not a document, directly writes the node.
        If node is a document, this has no effect.
        os - The output stream.
        indent - Indent string. If not null, pretty printing is enabled.
        features - The XmlWriter features to enable.
        Throws:
        IOException - When an IO error occurs.
      • save

        public static void save​(Document doc,
                                OutputStream os,
                                String indent,
                                XmlWriter.Feature... features)
                         throws IOException
        Saves a Document to an OutputStream.
        Parameters:
        doc - The document.
        os - The output stream.
        indent - Indent string. If not null, pretty printing is enabled.
        features - The XmlWriter features to enable.
        Throws:
        IOException - When an IO error occurs.
      • save

        public static void save​(Node node,
                                boolean asDocument,
                                String filename,
                                String indent,
                                XmlWriter.Feature... features)
                         throws IOException
        Saves a Node to a File.
        Parameters:
        node - The node.
        asDocument - If true and node is not a document, inserts XML heading <?xml version="1.0" encoding="UTF-8"?> before writing the node.
        If false and node is not a document, directly writes the node.
        If node is a document, this has no effect.
        filename - The file name.
        indent - Indent string. If not null, pretty printing is enabled.
        features - The XmlWriter features to enable.
        Throws:
        IOException - When an IO error occurs.
      • save

        public static void save​(Document doc,
                                String filename,
                                String indent,
                                XmlWriter.Feature... features)
                         throws IOException
        Saves a Document to a File.
        Parameters:
        doc - The document.
        filename - The file name.
        indent - Indent string. If not null, pretty printing is enabled.
        features - The XmlWriter features to enable.
        Throws:
        IOException - When an IO error occurs.
      • save

        public static void save​(Node node,
                                boolean asDocument,
                                File file,
                                String indent,
                                XmlWriter.Feature... features)
                         throws IOException
        Saves a Node to a File.
        Parameters:
        node - The node.
        asDocument - If true and node is not a document, inserts XML heading <?xml version="1.0" encoding="UTF-8"?> before writing the node.
        If false and node is not a document, directly writes the node.
        If node is a document, this has no effect.
        file - The file.
        indent - Indent string. If not null, pretty printing is enabled.
        features - The XmlWriter features to enable.
        Throws:
        IOException - When an IO error occurs.
      • save

        public static void save​(Document doc,
                                File file,
                                String indent,
                                XmlWriter.Feature... features)
                         throws IOException
        Saves a Document to a File.
        Parameters:
        doc - The document.
        file - The file.
        indent - Indent string. If not null, pretty printing is enabled.
        features - The XmlWriter features to enable.
        Throws:
        IOException - When an IO error occurs.