org.opencrx.application.uses.net.sf.webdav.fromcatalina
Class XMLWriter

java.lang.Object
  extended by org.opencrx.application.uses.net.sf.webdav.fromcatalina.XMLWriter

public class XMLWriter
extends Object

XMLWriter helper class.

Author:
Remy Maucherat

Field Summary
protected  StringBuffer _buffer
          Buffer.
protected  boolean _isRootElement
          Is true until the root element is written
protected  Map<String,String> _namespaces
          Namespaces to be declared in the root element
protected  Writer _writer
          Writer.
static int CLOSING
          Closing tag.
static int NO_CONTENT
          Element with no content.
static int OPENING
          Opening tag.
 
Constructor Summary
XMLWriter(Map<String,String> namespaces)
          Constructor.
XMLWriter(Writer writer, Map<String,String> namespaces)
          Constructor.
 
Method Summary
 void sendData()
          Send data and reinitializes buffer.
 String toString()
          Retrieve generated XML.
 void writeData(String data)
          Write data.
 void writeElement(String name, int type)
          Write an element.
 void writeProperty(String name)
          Write property to the XML.
 void writeProperty(String name, String value)
          Write property to the XML.
 void writeText(String text)
          Write text.
 void writeXMLHeader()
          Write XML Header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OPENING

public static final int OPENING
Opening tag.

See Also:
Constant Field Values

CLOSING

public static final int CLOSING
Closing tag.

See Also:
Constant Field Values

NO_CONTENT

public static final int NO_CONTENT
Element with no content.

See Also:
Constant Field Values

_buffer

protected StringBuffer _buffer
Buffer.


_writer

protected Writer _writer
Writer.


_namespaces

protected Map<String,String> _namespaces
Namespaces to be declared in the root element


_isRootElement

protected boolean _isRootElement
Is true until the root element is written

Constructor Detail

XMLWriter

public XMLWriter(Map<String,String> namespaces)
Constructor.


XMLWriter

public XMLWriter(Writer writer,
                 Map<String,String> namespaces)
Constructor.

Method Detail

toString

public String toString()
Retrieve generated XML.

Overrides:
toString in class Object
Returns:
String containing the generated XML

writeProperty

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

Parameters:
name - Property name
value - Property value

writeProperty

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

Parameters:
name - Property name

writeElement

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

Parameters:
name - Element name
type - Element type

writeText

public void writeText(String text)
Write text.

Parameters:
text - Text to append

writeData

public void writeData(String data)
Write data.

Parameters:
data - Data to append

writeXMLHeader

public void writeXMLHeader()
Write XML Header.


sendData

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

Throws:
IOException


This software is published under the BSD license. Copyright © 2003-2012, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.