org.apache.catalina.util

Class XMLWriter


public class XMLWriter
extends java.lang.Object

XMLWriter helper class.

Author:
Remy Maucherat

Field Summary

static int
CLOSING
Closing tag.
static int
NO_CONTENT
Element with no content.
static int
OPENING
Opening tag.
protected StringBuffer
buffer
Buffer.
protected Writer
writer
Writer.

Constructor Summary

XMLWriter()
Constructor.
XMLWriter(Writer writer)
Constructor.

Method Summary

void
sendData()
Send data and reinitializes buffer.
String
toString()
Retrieve generated XML.
void
writeData(String data)
Write data.
void
writeElement(String namespace, String namespaceInfo, String name, int type)
Write an element.
void
writeElement(String namespace, String name, int type)
Write an element.
void
writeProperty(String namespace, String name)
Write property to the XML.
void
writeProperty(String namespace, String name, String value)
Write property to the XML.
void
writeProperty(String namespace, String namespaceInfo, String name, String value)
Write property to the XML.
void
writeText(String text)
Write text.
void
writeXMLHeader()
Write XML Header.

Field Details

CLOSING

public static final int CLOSING
Closing tag.

Field Value:
1


NO_CONTENT

public static final int NO_CONTENT
Element with no content.

Field Value:
2


OPENING

public static final int OPENING
Opening tag.

Field Value:
0


buffer

protected StringBuffer buffer
Buffer.


writer

protected Writer writer
Writer.

Constructor Details

XMLWriter

public XMLWriter()
Constructor.


XMLWriter

public XMLWriter(Writer writer)
Constructor.

Method Details

sendData

public void sendData()
            throws IOException
Send data and reinitializes buffer.


toString

public String toString()
Retrieve generated XML.

Returns:
String containing the generated XML


writeData

public void writeData(String data)
Write data.

Parameters:
data - Data to append


writeElement

public void writeElement(String namespace,
                         String namespaceInfo,
                         String name,
                         int type)
Write an element.

Parameters:
namespace - Namespace abbreviation
namespaceInfo - Namespace info
name - Element name
type - Element type


writeElement

public void writeElement(String namespace,
                         String name,
                         int type)
Write an element.

Parameters:
namespace - Namespace abbreviation
name - Element name
type - Element type


writeProperty

public void writeProperty(String namespace,
                          String name)
Write property to the XML.

Parameters:
namespace - Namespace
name - Property name


writeProperty

public void writeProperty(String namespace,
                          String name,
                          String value)
Write property to the XML.

Parameters:
namespace - Namespace
name - Property name
value - Property value


writeProperty

public void writeProperty(String namespace,
                          String namespaceInfo,
                          String name,
                          String value)
Write property to the XML.

Parameters:
namespace - Namespace
namespaceInfo - Namespace info
name - Property name
value - Property value


writeText

public void writeText(String text)
Write text.

Parameters:
text - Text to append


writeXMLHeader

public void writeXMLHeader()
Write XML Header.


Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.