nu.staldal.xmltree
Class Text

java.lang.Object
  extended by nu.staldal.xmltree.Node
      extended by nu.staldal.xmltree.Text
All Implemented Interfaces:
java.io.Serializable, org.xml.sax.Locator

public class Text
extends Node

Character content in an XML document. This class is immutable.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class nu.staldal.xmltree.Node
parent
 
Constructor Summary
Text(char[] data, int start, int length, boolean forceCopy)
          Constructs a text node from a char[] buffer.
Text(java.lang.String value)
          Constructs a text node from a String.
 
Method Summary
 char[] asCharArray()
          Get the charater content as a char[].
 java.lang.String getValue()
          Get the charater content as a string
 boolean isWhitespaceNode()
          Check if this node consist of whitespace only.
 void toSAX(org.xml.sax.ContentHandler sax)
          Serialize this node, and recursively the (sub)tree beneath, into SAX2 events.
 
Methods inherited from class nu.staldal.xmltree.Node
getBaseURI, getColumnNumber, getInheritedAttribute, getLineNumber, getParent, getPreserveSpace, getPublicId, getSystemId, lookupNamespacePrefix, lookupNamespaceURI, setColumn, setLine, setPublicId, setSystemId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Text

public Text(char[] data,
            int start,
            int length,
            boolean forceCopy)
Constructs a text node from a char[] buffer.

Parameters:
data - a char[] buffer
start - the offset to read from in the buffer
length - the number of characters to read from the buffer
forceCopy - force copying of the data, if false a reference to the buffer may be kept.

Text

public Text(java.lang.String value)
Constructs a text node from a String.

Parameters:
value - the string
Method Detail

getValue

public java.lang.String getValue()
Get the charater content as a string

Returns:
the character content

asCharArray

public char[] asCharArray()
Get the charater content as a char[].

Returns:
the char[]

toSAX

public void toSAX(org.xml.sax.ContentHandler sax)
           throws org.xml.sax.SAXException
Description copied from class: Node
Serialize this node, and recursively the (sub)tree beneath, into SAX2 events.

Specified by:
toSAX in class Node
Parameters:
sax - the SAX2 ContentHander to fire events on.
Throws:
org.xml.sax.SAXException - if any of the ContentHandler methods throw it

isWhitespaceNode

public boolean isWhitespaceNode()
Description copied from class: Node
Check if this node consist of whitespace only.

Overrides:
isWhitespaceNode in class Node
Returns:
true if and only if this is a Text node which contains no other characters than whitespace.