Class AbstractXMLPrintVisitor

  • All Implemented Interfaces:
    SiteDataVisitor
    Direct Known Subclasses:
    XML3PrintVisitor, XML4PrintVisitor

    public abstract class AbstractXMLPrintVisitor
    extends java.lang.Object
    implements SiteDataVisitor
    The base class to be used by the various visitor implementors for displaying the Site Catalog in different XML formats
    Version:
    $Revision$
    Author:
    Karan Vahi
    • Field Detail

      • mWriter

        protected java.io.Writer mWriter
        The internal writer
      • mNewLine

        protected java.lang.String mNewLine
        The new line character to be used
      • mCurrentIndentIndex

        protected int mCurrentIndentIndex
        The number of tabs to use for current indent
    • Constructor Detail

      • AbstractXMLPrintVisitor

        public AbstractXMLPrintVisitor()
    • Method Detail

      • initialize

        public void initialize​(java.io.Writer writer)
        Initialize the visitor implementation
        Specified by:
        initialize in interface SiteDataVisitor
        Parameters:
        writer - the writer
      • writeAttribute

        public void writeAttribute​(java.lang.String key,
                                   java.lang.String value)
                            throws java.io.IOException
        Writes an attribute to the stream. Wraps the value in quotes as required by XML.
        Parameters:
        key - the attribute key
        value - the attribute value
        Throws:
        java.io.IOException
      • writeAttribute

        public void writeAttribute​(java.io.Writer writer,
                                   java.lang.String key,
                                   java.lang.String value)
                            throws java.io.IOException
        Writes an attribute to the stream. Wraps the value in quotes as required by XML.
        Parameters:
        writer - the stream to write to
        key - the attribute key
        value - the attribute value
        Throws:
        java.io.IOException
      • getCurrentIndent

        public java.lang.String getCurrentIndent()
        Returns the current indent to be used while writing out
        Returns:
        the current indent
      • getNextIndent

        public java.lang.String getNextIndent()
        Returns the indent to be used for the nested element.
        Returns:
        the new indent
      • incrementIndentIndex

        public void incrementIndentIndex()
        Increments the indent index
      • decrementIndentIndex

        public void decrementIndentIndex()
        Decrements the indent index
      • closeElement

        public void closeElement​(java.lang.String element)
                          throws java.io.IOException
        Generates a closing tag for an element
        Parameters:
        element - the element tag name
        Throws:
        java.io.IOException
      • visit

        public void visit​(SiteData data)
                   throws java.io.IOException
        Specified by:
        visit in interface SiteDataVisitor
        Throws:
        java.io.IOException
      • depart

        public void depart​(SiteData data)
                    throws java.io.IOException
        Specified by:
        depart in interface SiteDataVisitor
        Throws:
        java.io.IOException