edu.isi.pegasus.common.util

## Class XMLWriter

- java.lang.Object
- - edu.isi.pegasus.common.util.XMLWriter

    public class XMLWriter
    extends java.lang.Object

Author:
  gmehta

### Field Summary

Fields
`private static java.lang.String` `CLOSE_COMMENT_TAG`
`private static java.lang.String` `CLOSE_ELEMENT_TAG`
`private static java.lang.String` `CLOSE_EMPTY_ELEMENT_TAG`
`private static java.lang.String` `INDENT`
`private java.lang.StringBuffer` `mAttributes`
`private boolean` `mClosedElement`
`private boolean` `mEmptyElement`
`private boolean` `mHeader`
`private java.lang.String` `mLineSeparator`
`private LogManager` `mLogger`
`private java.lang.String` `mNamespace`
`private java.util.Stack<java.lang.String>` `mStack`
`private boolean` `mWriteLine`
`private java.io.Writer` `mWriter`
`private static java.lang.String` `START_COMMENT_TAG`
`private static java.lang.String` `START_ELEMENT_TAG`
`private static java.lang.String` `START_END_ELEMENT_TAG`
`private static java.lang.String` `XML_HEADER`

### Constructor Summary

Constructors
Constructor and Description
`XMLWriter(java.io.Writer writer)`
`XMLWriter(java.io.Writer writer, java.lang.String namespace)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `close()`
`private void` `closeElement()` Close open elements start tag.
`XMLWriter` `endElement()`
`XMLWriter` `endElement(int indent)`
`private static java.lang.String` `escapeXML(java.lang.String str)`
`private XMLWriter` `indent(int indent)`
`XMLWriter` `noLine()`
`XMLWriter` `startElement(java.lang.String name)`
`XMLWriter` `startElement(java.lang.String name, int indent)`
`XMLWriter` `writeAttribute(java.lang.String key, java.lang.String value)`
`private void` `writeAttributes()` Writes out the attributes of a given element to the writer
`XMLWriter` `writeCData(java.lang.String data)`
`XMLWriter` `writeData(java.lang.String data)`
`XMLWriter` `writeLine()`
`XMLWriter` `writeUnEscapedData(java.lang.String data)`
`XMLWriter` `writeXMLComment(java.lang.String comment)`
`XMLWriter` `writeXMLComment(java.lang.String comment, boolean linepadded)`
`XMLWriter` `writeXMLHeader()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### mWriter

    private java.io.Writer mWriter

#### mStack

    private java.util.Stack<java.lang.String> mStack

#### mAttributes

    private java.lang.StringBuffer mAttributes

#### mEmptyElement

    private boolean mEmptyElement

#### mClosedElement

    private boolean mClosedElement

#### mWriteLine

    private boolean mWriteLine

#### mHeader

    private boolean mHeader

#### mLogger

    private LogManager mLogger

#### START_ELEMENT_TAG

    private static java.lang.String START_ELEMENT_TAG

#### CLOSE_ELEMENT_TAG

    private static java.lang.String CLOSE_ELEMENT_TAG

#### START_END_ELEMENT_TAG

    private static java.lang.String START_END_ELEMENT_TAG

#### CLOSE_EMPTY_ELEMENT_TAG

    private static java.lang.String CLOSE_EMPTY_ELEMENT_TAG

#### START_COMMENT_TAG

    private static java.lang.String START_COMMENT_TAG

#### CLOSE_COMMENT_TAG

    private static java.lang.String CLOSE_COMMENT_TAG

#### INDENT

    private static java.lang.String INDENT

#### XML_HEADER

    private static java.lang.String XML_HEADER

#### mLineSeparator

    private java.lang.String mLineSeparator

#### mNamespace

    private java.lang.String mNamespace

### Constructor Detail

#### XMLWriter

    public XMLWriter(java.io.Writer writer)

#### XMLWriter

    public XMLWriter(java.io.Writer writer,
                     java.lang.String namespace)

### Method Detail

#### startElement

    public XMLWriter startElement(java.lang.String name)

#### startElement

    public XMLWriter startElement(java.lang.String name,
                                  int indent)

#### endElement

    public XMLWriter endElement()

#### endElement

    public XMLWriter endElement(int indent)

#### writeData

    public XMLWriter writeData(java.lang.String data)

#### writeUnEscapedData

    public XMLWriter writeUnEscapedData(java.lang.String data)

#### writeLine

    public XMLWriter writeLine()

#### noLine

    public XMLWriter noLine()

#### writeCData

    public XMLWriter writeCData(java.lang.String data)

#### writeAttribute

    public XMLWriter writeAttribute(java.lang.String key,
                                    java.lang.String value)

#### writeAttributes

    private void writeAttributes()

Writes out the attributes of a given element to the writer

#### closeElement

    private void closeElement()

Close open elements start tag. Write any attributes. This is called when either a new child element is added to existing element or data is added.

#### writeXMLHeader

    public XMLWriter writeXMLHeader()

#### writeXMLComment

    public XMLWriter writeXMLComment(java.lang.String comment,
                                     boolean linepadded)

#### writeXMLComment

    public XMLWriter writeXMLComment(java.lang.String comment)

#### indent

    private XMLWriter indent(int indent)

#### escapeXML

    private static java.lang.String escapeXML(java.lang.String str)

#### close

    public void close()