com.alien.enterpriseRFID.util
Class XMLWriter

java.lang.Object
  extended bycom.alien.enterpriseRFID.util.XMLWriter

public class XMLWriter
extends java.lang.Object

This is a simple XML utility class that writes the contents of a Hashtable into an XML-formatted text string.

Version:
1.2 Feb 2004
Author:
Chris Parkinson, David Krull

Constructor Summary
XMLWriter(java.util.Hashtable hashtable)
          Constructs a new XMLWriter to convert a Hashtable to an XML-formatted text string.
XMLWriter(java.util.Hashtable hashtable, java.lang.String topLevelTag)
          Constructs a new XMLWriter to convert a Hashtable to an XML-formatted text string.
XMLWriter(java.util.Hashtable hashtable, java.lang.String topLevelTag, java.lang.String lineTerminator)
          Constructs a new XMLWriter to convert a Hashtable to an XML-formatted text string.
 
Method Summary
 java.util.Hashtable getHashtable()
          Returns the Hashtable that this XMLWriter uses to generate its XML document.
 int getIndentSize()
          Returns the number of space characters used to indent each level of XML output.
 java.lang.String getLineTerminator()
          Returns the line terminator string that this XMLWriter uses to end each of the lines of its XML output.
 java.lang.String getTopLevelTag()
          Returns the top-level tag string that this XML writer wraps around its XML output.
 void setHashtable(java.util.Hashtable hashtable)
          Sets the Hashtable that this XMLWriter uses to generate its XML document.
 void setIndentSize(int indentSize)
          Sets the number of space characters used to indent each level of XML output.
 void setLineTerminator(java.lang.String lineTerminator)
          Sets the line terminator string that this XMLWriter uses to end each of the lines of its XML output.
 void setTopLevelTag(java.lang.String topLevelTag)
          Sets the top-level tag string that this XML writer wraps around its XML output.
 java.lang.String writeXML()
          Writes out the contents of this XMLWriter's Hashtable to an XML-formatted string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLWriter

public XMLWriter(java.util.Hashtable hashtable)
Constructs a new XMLWriter to convert a Hashtable to an XML-formatted text string.

Parameters:
hashtable - the Hashtable to write out

XMLWriter

public XMLWriter(java.util.Hashtable hashtable,
                 java.lang.String topLevelTag)
Constructs a new XMLWriter to convert a Hashtable to an XML-formatted text string. This version allows you to specify a top-level tag with which to surround the generated XML text.

Parameters:
hashtable - the Hashtable to write out
topLevelTag - tag name to encapsulate output with

XMLWriter

public XMLWriter(java.util.Hashtable hashtable,
                 java.lang.String topLevelTag,
                 java.lang.String lineTerminator)
Constructs a new XMLWriter to convert a Hashtable to an XML-formatted text string. This version allows you to specify a top-level tag with which to surround the generated XML text, as well as a line terminator other than the default "\r\n",

Parameters:
hashtable - the Hashtable to write out
topLevelTag - tag name to encapsulate output with
lineTerminator - the string to place at the end of each line
Method Detail

getHashtable

public java.util.Hashtable getHashtable()
Returns the Hashtable that this XMLWriter uses to generate its XML document.

Returns:
this XMLWriter's hashtable
See Also:
setHashtable(Hashtable)

setHashtable

public void setHashtable(java.util.Hashtable hashtable)
Sets the Hashtable that this XMLWriter uses to generate its XML document.

Parameters:
hashtable - this XMLWriter's hashtable
See Also:
getHashtable()

getLineTerminator

public java.lang.String getLineTerminator()
Returns the line terminator string that this XMLWriter uses to end each of the lines of its XML output.

Returns:
the line terminator string
See Also:
setLineTerminator(String)

setLineTerminator

public void setLineTerminator(java.lang.String lineTerminator)
Sets the line terminator string that this XMLWriter uses to end each of the lines of its XML output.

Parameters:
lineTerminator - the string to use to terminate each line of XML output
See Also:
getLineTerminator()

getTopLevelTag

public java.lang.String getTopLevelTag()
Returns the top-level tag string that this XML writer wraps around its XML output.

Returns:
the top-level tag for XML output
See Also:
setTopLevelTag(String)

setTopLevelTag

public void setTopLevelTag(java.lang.String topLevelTag)
Sets the top-level tag string that this XML writer wraps around its XML output.

Parameters:
topLevelTag - the top-level tag for XML output
See Also:
getTopLevelTag()

getIndentSize

public int getIndentSize()
Returns the number of space characters used to indent each level of XML output.

Returns:
the indent size (# of spaces)
See Also:
setIndentSize(int)

setIndentSize

public void setIndentSize(int indentSize)
Sets the number of space characters used to indent each level of XML output.

Parameters:
indentSize - the index size (# of spaces)

writeXML

public java.lang.String writeXML()
Writes out the contents of this XMLWriter's Hashtable to an XML-formatted string.

Returns:
an XML string repesentation of the Hashtable