Class XmlDomWriter


  • public class XmlDomWriter
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean fCanonical
      Canonical output.
      private java.io.PrintWriter fOut
      Print writer.
      private boolean fXML11
      Processing XML 1.1 document.
    • Constructor Summary

      Constructors 
      Constructor Description
      XmlDomWriter()
      Default constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void normalizeAndPrint​(char c, boolean isAttValue)
      Normalizes and print the given character.
      private void normalizeAndPrint​(java.lang.String s, boolean isAttValue)
      Normalizes and prints the given string.
      void setCanonical​(boolean canonical)
      Sets whether output is canonical.
      void setOutput​(java.io.OutputStream stream, java.lang.String encoding)
      Sets the output stream for printing.
      void setOutput​(java.io.Writer writer)
      Sets the output writer.
      private org.w3c.dom.Attr[] sortAttributes​(org.w3c.dom.NamedNodeMap attrs)
      Returns a sorted list of attributes.
      void write​(org.w3c.dom.Node node)
      Writes the specified node, recursively.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • fOut

        private java.io.PrintWriter fOut
        Print writer.
      • fCanonical

        private boolean fCanonical
        Canonical output.
      • fXML11

        private boolean fXML11
        Processing XML 1.1 document.
    • Constructor Detail

      • XmlDomWriter

        public XmlDomWriter()
        Default constructor.
    • Method Detail

      • setCanonical

        public void setCanonical​(boolean canonical)
        Sets whether output is canonical.
        Parameters:
        canonical - Canonical
      • setOutput

        public void setOutput​(java.io.OutputStream stream,
                              java.lang.String encoding)
                       throws java.io.UnsupportedEncodingException
        Sets the output stream for printing.
        Parameters:
        stream - Stream
        encoding - Encoding
        Throws:
        java.io.UnsupportedEncodingException - on error
      • setOutput

        public void setOutput​(java.io.Writer writer)
        Sets the output writer.
        Parameters:
        writer - Writer
      • write

        public void write​(org.w3c.dom.Node node)
        Writes the specified node, recursively.
        Parameters:
        node - Node
      • sortAttributes

        private org.w3c.dom.Attr[] sortAttributes​(org.w3c.dom.NamedNodeMap attrs)
        Returns a sorted list of attributes.
        Parameters:
        attrs - Attributes
        Returns:
        Attributes
      • normalizeAndPrint

        private void normalizeAndPrint​(java.lang.String s,
                                       boolean isAttValue)
        Normalizes and prints the given string.
        Parameters:
        s - String
        isAttValue - Attribute value
      • normalizeAndPrint

        private void normalizeAndPrint​(char c,
                                       boolean isAttValue)
        Normalizes and print the given character.
        Parameters:
        c - Char
        isAttValue - Is attribute