Class AbstractXMLPrintVisitor
- java.lang.Object
-
- edu.isi.pegasus.planner.catalog.site.classes.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 Summary
Fields Modifier and Type Field Description protected int
mCurrentIndentIndex
The number of tabs to use for current indentprotected java.lang.String
mNewLine
The new line character to be usedprotected java.io.Writer
mWriter
The internal writer
-
Constructor Summary
Constructors Constructor Description AbstractXMLPrintVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeElement(java.lang.String element)
Generates a closing tag for an elementvoid
decrementIndentIndex()
Decrements the indent indexvoid
depart(SiteData data)
java.lang.String
getCurrentIndent()
Returns the current indent to be used while writing outjava.lang.String
getNextIndent()
Returns the indent to be used for the nested element.void
incrementIndentIndex()
Increments the indent indexvoid
initialize(java.io.Writer writer)
Initialize the visitor implementationvoid
visit(SiteData data)
void
writeAttribute(java.io.Writer writer, java.lang.String key, java.lang.String value)
Writes an attribute to the stream.void
writeAttribute(java.lang.String key, java.lang.String value)
Writes an attribute to the stream.
-
-
-
Method Detail
-
initialize
public void initialize(java.io.Writer writer)
Initialize the visitor implementation- Specified by:
initialize
in interfaceSiteDataVisitor
- 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 keyvalue
- 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 tokey
- the attribute keyvalue
- 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 interfaceSiteDataVisitor
- Throws:
java.io.IOException
-
depart
public void depart(SiteData data) throws java.io.IOException
- Specified by:
depart
in interfaceSiteDataVisitor
- Throws:
java.io.IOException
-
-