Top Description Fields Constructors Methods
org.jdom

public Class Text

extends Content
Class Inheritance
Known Direct Subclasses
org.jdom.CDATA

Character-based XML content. Provides a modular, parentable method of representing text. Text makes no guarantees about the underlying textual representation of character data, but does expose that data as a Java String.
Authors
Brett McLaughlin, Jason Hunter, Bradley S. Huffman
Version
$Revision: 1.25 $, $Date: 2007/11/10 05:28:59 $

Field Summary

Modifier and TypeField and Description
private static final String
pack-priv static final String
protected String
value

The actual character content

Inherited from org.jdom.Content:
parent

Constructor Summary

AccessConstructor and Description
protected
Text()

This is the protected, no-args constructor standard in all JDOM classes.

public
Text(String
the node's character content.
str
)

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

Method Summary

Modifier and TypeMethod and Description
public void
append(String
character content to append.
str
)

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

public void
append(Text
Text node to append.
text
)

This will append the content of another Text node to this node.

public Object

Returns:

Text - cloned node.
clone
()

Overrides org.jdom.Content.clone.

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

Returns:

String - character content of this node.
getText
()

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

public String

Returns:

normalized text content or empty string
getTextNormalize
()

This returns the textual content with all surrounding whitespace removed and internal whitespace normalized to a single space.

public String

Returns:

trimmed text content or empty string
getTextTrim
()

This returns the textual content with all surrounding whitespace removed.

public String

Returns:

the text
getValue
()

Implements abstract org.jdom.Content.getValue.

Returns the XPath 1.0 string value of this element, which is the text itself.
public static String

Returns:

normalized string or empty string
normalizeString
(String
string to be normalized.
str
)

This returns a new string with all surrounding whitespace removed and internal whitespace normalized to a single space.

public Text

Returns:

the object on which the method was invoked
setText
(String
value for node's content.
str
)

This will set the value of this Text node.

public String

Returns:

String - information about this node.
toString
()

Overrides java.lang.Object.toString.

This returns a String representation of the Text node, suitable for debugging.
Inherited from org.jdom.Content:
detachequalsgetDocumentgetParentgetParentElementhashCodesetParent

Field Detail

CVS_IDback to summary
private static final String CVS_ID
EMPTY_STRINGback to summary
pack-priv static final String EMPTY_STRING
valueback to summary
protected String value

The actual character content

Constructor Detail

Textback to summary
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.

Textback to summary
public Text(String str)

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

Parameters
str:String

the node's character content.

Exceptions
IllegalDataException:
if str contains an illegal character such as a vertical tab (as determined by org.jdom.Verifier#checkCharacterData)

Method Detail

appendback to summary
public void append(String str)

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

Parameters
str:String

character content to append.

Exceptions
IllegalDataException:
if str contains an illegal character such as a vertical tab (as determined by org.jdom.Verifier#checkCharacterData)
appendback to summary
public void append(Text text)

This will append the content of another Text node to this node.

Parameters
text:Text

Text node to append.

cloneback to summary
public Object clone()

Overrides org.jdom.Content.clone.

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

Returns:Object

Text - cloned node.

getTextback to summary
public String getText()

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

Returns:String

String - character content of this node.

getTextNormalizeback to summary
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.

Returns:String

normalized text content or empty string

getTextTrimback to summary
public String getTextTrim()

This returns the textual content with all surrounding whitespace removed. If only whitespace exists, the empty string is returned.

Returns:String

trimmed text content or empty string

getValueback to summary
public String getValue()

Implements abstract org.jdom.Content.getValue.

Returns the XPath 1.0 string value of this element, which is the text itself.

Returns:String

the text

normalizeStringback to summary
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

Parameters
str:String

string to be normalized.

Returns:String

normalized string or empty string

setTextback to summary
public Text setText(String str)

This will set the value of this Text node.

Parameters
str:String

value for node's content.

Returns:Text

the object on which the method was invoked

Exceptions
IllegalDataException:
if str contains an illegal character such as a vertical tab (as determined by org.jdom.Verifier#checkCharacterData)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

This returns a String representation of the Text node, suitable for debugging. If the XML representation of the Text node is desired, either getText or org.jdom.output.XMLOutputter#outputString(Text) should be used.

Returns:String

String - information about this node.