xmlBlaster 1.6.2 client API

org.xmlBlaster.util
Class XmlBuffer

java.lang.Object
  extended byorg.xmlBlaster.util.XmlBuffer

public class XmlBuffer
extends java.lang.Object

Same as StringBuffer but has the additional method appendEscaped() which escapes predefined XML identities.

Author:
mr@marcelruff.info

Constructor Summary
XmlBuffer(int len)
           
 
Method Summary
 XmlBuffer append(boolean b)
          Aquivalent to a StringBuffer.append().
 XmlBuffer append(double ln)
          Aquivalent to a StringBuffer.append().
 XmlBuffer append(float ln)
          Aquivalent to a StringBuffer.append().
 XmlBuffer append(long ln)
          Aquivalent to a StringBuffer.append().
 XmlBuffer append(java.lang.String str)
          Aquivalent to a StringBuffer.append().
static void append(java.lang.StringBuffer buf, java.lang.String text)
          Escape predefined xml entities (&, <, >, ', ").
static void appendAttr(java.lang.StringBuffer buf, java.lang.String text)
          Escape predefined xml entities (\0, ', ", \r).
 XmlBuffer appendAttributeEscaped(java.lang.String text)
          Escape predefined xml entities (', ", \r) for attributes.
 XmlBuffer appendEscaped(java.lang.String text)
          Escape predefined xml entities (&, <, >, ', ").
 XmlBuffer appendTag(java.lang.String tagName)
          Appends a tag name (e.g.
static java.lang.String escape(java.lang.String text)
          Escape predefined xml entities (&, <, >, ', ").
 java.lang.StringBuffer getRawBuffer()
           
 int length()
           
 void reset()
          Removes all buffer entries.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XmlBuffer

public XmlBuffer(int len)
Method Detail

appendEscaped

public XmlBuffer appendEscaped(java.lang.String text)
Escape predefined xml entities (&, <, >, ', "). Additionally the '\0' is escaped.

Parameters:
text -
Returns:
The escaped text is appended to the StringBuffer.

appendAttributeEscaped

public XmlBuffer appendAttributeEscaped(java.lang.String text)
Escape predefined xml entities (', ", \r) for attributes. Additionally the '\0' is escaped.

Parameters:
text -
Returns:
The escaped text is appended to the StringBuffer.

appendTag

public XmlBuffer appendTag(java.lang.String tagName)
Appends a tag name (e.g. "bla" of a tag called ). Currently is a normal append()

Parameters:
tagName - Could in future escape invalid tokens '<' and '&' in a tag name.
Returns:

append

public XmlBuffer append(java.lang.String str)
Aquivalent to a StringBuffer.append().


append

public XmlBuffer append(long ln)
Aquivalent to a StringBuffer.append().


append

public XmlBuffer append(float ln)
Aquivalent to a StringBuffer.append().


append

public XmlBuffer append(double ln)
Aquivalent to a StringBuffer.append().


append

public XmlBuffer append(boolean b)
Aquivalent to a StringBuffer.append().


getRawBuffer

public java.lang.StringBuffer getRawBuffer()

length

public int length()

reset

public void reset()
Removes all buffer entries. Calling append fills new data to the beginning of the buffer.


toString

public java.lang.String toString()

escape

public static java.lang.String escape(java.lang.String text)
Escape predefined xml entities (&, <, >, ', "). Additionally the '\0' is escaped.

Parameters:
text - e.g. "Hello < and &"
Returns:
"Hello < and &"

append

public static void append(java.lang.StringBuffer buf,
                          java.lang.String text)
Escape predefined xml entities (&, <, >, ', "). Additionally the '\0' is escaped.

Parameters:
text -
Returns:
The escaped text is appended to the given StringBuffer.

appendAttr

public static void appendAttr(java.lang.StringBuffer buf,
                              java.lang.String text)
Escape predefined xml entities (\0, ', ", \r). for attribute notation Additionally the '\0' is escaped.

Parameters:
text -
Returns:
The escaped text is appended to the given StringBuffer.

xmlBlaster 1.6.2 client API

Copyright © 1999-2007 The xmlBlaster.org contributers.