public class Text extends Content
Modifier and Type | Field and Description |
---|---|
protected String |
value
The actual character content
|
Modifier | Constructor and Description |
---|---|
protected |
Text()
This is the protected, no-args constructor standard in all JDOM
classes.
|
|
Text(String str)
This constructor creates a new
Text node, with the
supplied string value as it's character content. |
Modifier and Type | Method and Description |
---|---|
void |
append(String str)
This will append character content to whatever content already
exists within this
Text node. |
void |
append(Text text)
This will append the content of another
Text node
to this node. |
Object |
clone()
This will return a clone of this
Text node, with the
same character content, but no parent. |
String |
getText()
This returns the value of this
Text node as a Java
String . |
String |
getTextNormalize()
This returns the textual content with all surrounding whitespace
removed and internal whitespace normalized to a single space.
|
String |
getTextTrim()
This returns the textual content with all surrounding whitespace
removed.
|
String |
getValue()
Returns the XPath 1.0 string value of this element, which is the
text itself.
|
static String |
normalizeString(String str)
This returns a new string with all surrounding whitespace
removed and internal whitespace normalized to a single space.
|
Text |
setText(String str)
This will set the value of this
Text node. |
String |
toString()
This returns a
String representation of the
Text node, suitable for debugging. |
detach, equals, getDocument, getParent, getParentElement, hashCode, setParent
protected String value
protected Text()
public Text(String str)
Text
node, with the
supplied string value as it's character content.str
- the node's character content.IllegalDataException
- if str
contains an
illegal character such as a vertical tab (as determined
by Verifier.checkCharacterData(java.lang.String)
)public String getText()
Text
node as a Java
String
.String
- character content of this node.public String getTextTrim()
public String getTextNormalize()
public static String normalizeString(String str)
Per XML 1.0 Production 3 whitespace includes: #x20, #x9, #xD, #xA
str
- string to be normalized.public Text setText(String str)
Text
node.str
- value for node's content.IllegalDataException
- if str
contains an
illegal character such as a vertical tab (as determined
by Verifier.checkCharacterData(java.lang.String)
)public void append(String str)
Text
node.str
- character content to append.IllegalDataException
- if str
contains an
illegal character such as a vertical tab (as determined
by Verifier.checkCharacterData(java.lang.String)
)public void append(Text text)
Text
node
to this node.text
- Text node to append.public String getValue()
public String toString()
String
representation of the
Text
node, suitable for debugging. If the XML
representation of the Text
node is desired,
either getText()
or
XMLOutputter.outputString(Text)
should be used.Copyright © 2012 JBoss by Red Hat. All Rights Reserved.