All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----org.jdom.Text
Text
represents character-based content within an
XML document represented by JDOM. It is intended to provide a modular,
parentable 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
.
Text
node's parent.
This is the protected, no-args constructor standard in all JDOM classes.
This constructor creates a new Text
node, with the
supplied string value as it's character content.
This will append character content to whatever content already
exists within this Text
node.
This will append the content of another Text
node
to this node.
This will return a clone of this Text
node, with the
same character content, but no parent.
Detaches the Text
from its parent, or does nothing
if the Text
has no parent.
This tests for equality of this Text
to the supplied
Object
, explicitly using the == operator.
This retrieves the owning This will return the parent of this This returns the value of this
This returns the textual content with all surrounding whitespace
removed and internal whitespace normalized to a single space.
This returns the textual content with all surrounding whitespace
removed.
This will generate a hash code for this node.
This returns a new string with all surrounding whitespace
removed and internal whitespace normalized to a single space.
This will set the parent of the This will set the value of this This returns a {
getParent()
Text
node, which
is always a JDOM {
getText()
Text
node as a Java
String
.
getTextNormalize()
getTextTrim()
hashCode()
normalizeString(String)
setParent(Element)
Text
node to the supplied
{
setText(String)
Text
node.
toString()
String
representation of the
Text
node, suitable for debugging.
protected String value
protected Object parent
Text
node's parent.
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.
public Text(String str)
This constructor creates a new Text
node, with the
supplied string value as it's character content.
public String getText()
This returns the value of this Text
node as a Java
String
.
String
- character content of this node.
public String getTextTrim()
This returns the textual content with all surrounding whitespace removed. If only whitespace exists, the empty string is returned.
public String getTextNormalize()
This returns the textual content with all surrounding whitespace removed and internal whitespace normalized to a single space. If only whitespace exists, the empty string is returned.
public static String normalizeString(String str)
This returns a new string with all surrounding whitespace removed and internal whitespace normalized to a single space. If only whitespace exists, the empty string is returned.
Per XML 1.0 Production 3 whitespace includes: #x20, #x9, #xD, #xA
public Text setText(String str)
This will set the value of this Text
node.
public void append(String str)
This will append character content to whatever content already
exists within this Text
node.
public void append(Text text)
This will append the content of another Text
node
to this node.
public Element getParent()
This will return the parent of this Text
node, which
is always a JDOM {@link Element}
.
Element
- this node's parent.
public Document getDocument()
This retrieves the owning {@link Document}
for
this Text
, or null if not a currently a member
of a {@link Document}
.
Document
owning this Text
, or null.
protected Text setParent(Element parent)
This will set the parent of the Text
node to the supplied
{@link Element}
. This method is intentionally left as
protected
so that only JDOM internals use it.
If you need an instance of this Text
node with a new
parent, you should get a copy of this node with
{@link #clone}
and set it on the desired (new) parent
Element
.
public Text detach()
Detaches the Text
from its parent, or does nothing
if the Text
has no parent.
Text
- this Text
modified.
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 {@link #getText}
or
{@link org.jdom.output.XMLOutputter#outputString(Text)}
should be used.
String
- information about this node.
public final int hashCode()
This will generate a hash code for this node.
int
- hash code for this node.
public Object clone()
This will return a clone of this Text
node, with the
same character content, but no parent.
Text
- cloned node.
public final boolean equals(Object ob)
This tests for equality of this Text
to the supplied
Object
, explicitly using the == operator.
Object
to compare to
Text
nodes are equal
All Packages Class Hierarchy This Package Previous Next Index