Class XMLWriter

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.Appendable, java.lang.AutoCloseable

    public class XMLWriter
    extends java.io.Writer
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Node current  
      • Fields inherited from class java.io.Writer

        lock
    • Constructor Summary

      Constructors 
      Constructor Description
      XMLWriter​(java.io.Writer writer)  
    • Field Detail

      • current

        protected Node current
    • Constructor Detail

      • XMLWriter

        public XMLWriter​(java.io.Writer writer)
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in class java.io.Writer
        Throws:
        java.io.IOException
      • flush

        public void flush()
                   throws java.io.IOException
        Specified by:
        flush in interface java.io.Flushable
        Specified by:
        flush in class java.io.Writer
        Throws:
        java.io.IOException
      • write

        public void write​(char[] cbuf,
                          int off,
                          int len)
                   throws java.io.IOException
        Specified by:
        write in class java.io.Writer
        Throws:
        java.io.IOException
      • write

        public void write​(Node node,
                          java.lang.String s)
                   throws java.io.IOException
        If you want to see every node written to the underlying writer, this is the place.
        Parameters:
        node -
        s -
        Throws:
        java.io.IOException
      • writeAttributeValue

        public void writeAttributeValue​(Node node,
                                        java.lang.String value,
                                        char quoteChar)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • writeChildNodes

        public void writeChildNodes​(NodeWithChildren node)
                             throws java.io.IOException
        Write all children of a node
        Throws:
        java.io.IOException
      • write

        public void write​(Element e)
                   throws java.io.IOException
        Write an element with all attributes and children
        Throws:
        java.io.IOException
      • writeEndElement

        public void writeEndElement​(Element e)
                             throws java.io.IOException
        Write the end tag of an element
        Throws:
        java.io.IOException
      • writeBeginElement

        public void writeBeginElement​(Element e)
                               throws java.io.IOException
        Write the start tag of an element including the attributes.
        Throws:
        java.io.IOException
      • isCompact

        public boolean isCompact​(Element e)
      • hasSingleTextChild

        public boolean hasSingleTextChild​(Element e)
      • indent

        public void indent()
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • nl

        public void nl()
                throws java.io.IOException
        Throws:
        java.io.IOException
      • writeAttributes

        public void writeAttributes​(Element e)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • setIndent

        public void setIndent​(java.lang.String indent)
      • getIndent

        public java.lang.String getIndent()
      • setPadCompact

        public void setPadCompact​(boolean padCompact)
      • isPadCompact

        public boolean isPadCompact()
        If this is true, the writer makes sure that there is a single space before "/>"