org.jdom
Class Text

java.lang.Object
  |
  +--org.jdom.Text

public class Text
extends Object
implements Serializable, Cloneable

Text represents character-based content within an XML document represented by JDOM. It is intended to provide a modular, perantable method of representing that text. Additionally, Text makes no guarantees about the underlying textual representation of character data, but does expose that data as a Java String.

Version:
1.0
Author:
Brett McLaughlin
See Also:
Serialized Form

Field Summary
protected  Element parent
          This Text node's parent.
protected  StringBuffer value
          The actual character content
 
Constructor Summary
protected Text()
          This is the protected, no-args constructor standard in all JDOM classes.
  Text(String stringValue)
          This constructor creates a new Text node, with the supplied value as it's character content.
 
Method Summary
 void append(String stringValue)
          This will append character content to whatever content already exists within this Text node.
 Object clone()
          This will return a clone of this Text node, with the same character content, but no parent.
 boolean equals(Object ob)
           This tests for equality of this Text to the supplied Object, explicitly using the == operator.
 Document getDocument()
           This retrieves the owning Document for this Text, or null if not a currently a member of a Document.
 Element getParent()
          This will return the parent of this Text node, which is always a JDOM Element.
 String getValue()
          This returns the value of this Text node as a Java String.
 int hashCode()
          This will generate a hash code for this node.
 void setValue(String stringValue)
          This will set the value of this Text node.
 String toString()
          This returns a String representation of the Text node, suitable for debugging.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected StringBuffer value
The actual character content

parent

protected Element parent
This Text node's parent.
Constructor Detail

Text

protected Text()

This is the protected, no-args constructor standard in all JDOM classes. It allows subclassers to get a raw instance with no initialization.


Text

public Text(String stringValue)

This constructor creates a new Text node, with the supplied value as it's character content.

Parameters:
stringValue - the node's character content.
Method Detail

getValue

public String getValue()

This returns the value of this Text node as a Java String.

Returns:
String - character content of this node.

setValue

public void setValue(String stringValue)

This will set the value of this Text node.

Parameters:
stringValue - value for node's content.

append

public void append(String stringValue)

This will append character content to whatever content already exists within this Text node.

Parameters:
stringValue - character content to append.

getParent

public Element getParent()

This will return the parent of this Text node, which is always a JDOM Element.

Returns:
Element - this node's parent.

getDocument

public Document getDocument()

This retrieves the owning Document for this Text, or null if not a currently a member of a Document.

Returns:
Document owning this Text, or null.

toString

public String toString()

This returns a String representation of the Text node, suitable for debugging. If the XML representation of the Text node is desired, either getValue() or XMLOutputter.output(Text, Writer) should be used.

Overrides:
toString in class Object
Returns:
String - information about this node.

hashCode

public final int hashCode()

This will generate a hash code for this node.

Overrides:
hashCode in class Object
Returns:
int - hash code for this node.

clone

public Object clone()

This will return a clone of this Text node, with the same character content, but no parent.

Overrides:
clone in class Object
Returns:
Text - cloned node.

equals

public final boolean equals(Object ob)

This tests for equality of this Text to the supplied Object, explicitly using the == operator.

Overrides:
equals in class Object
Parameters:
ob - Object to compare to
Returns:
whether the Text nodes are equal


Copyright © 2001 Jason Hunter, Brett McLaughlin. All Rights Reserved.