public class Text extends Content
Content.CType
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
value
The actual character content
|
Modifier | Constructor and Description |
---|---|
protected |
Text()
This is the protected, no-args constructor standard in all JDOM
classes.
|
protected |
Text(Content.CType ctype)
CData type extends Text, and it needs to be able to change the Content
type of this Content.
|
|
Text(java.lang.String str)
This constructor creates a new
Text node, with the
supplied string value as its character content. |
Modifier and Type | Method and Description |
---|---|
void |
append(java.lang.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. |
Text |
clone()
Return a deep clone of this instance.
|
Text |
detach()
Detaches this child from its parent or does nothing if the child
has no parent.
|
Element |
getParent()
Return this child's parent, or null if this child is currently
not attached.
|
java.lang.String |
getText()
This returns the value of this
Text node as a Java
String . |
java.lang.String |
getTextNormalize()
This returns the textual content with all surrounding whitespace
removed and internal whitespace normalized to a single space.
|
java.lang.String |
getTextTrim()
This returns the textual content with all surrounding whitespace
removed.
|
java.lang.String |
getValue()
Returns the XPath 1.0 string value of this element, which is the
text itself.
|
static java.lang.String |
normalizeString(java.lang.String str)
This returns a new string with all surrounding whitespace
removed and internal whitespace normalized to a single space.
|
protected Text |
setParent(Parent parent)
Sets the parent of this Content.
|
Text |
setText(java.lang.String str)
This will set the value of this
Text node. |
java.lang.String |
toString()
This returns a
String representation of the
Text node, suitable for debugging. |
equals, getCType, getDocument, getNamespacesInherited, getNamespacesInScope, getNamespacesIntroduced, getParentElement, hashCode
protected Text(Content.CType ctype)
ctype
- The CType to set for this Text-based Content.protected Text()
public Text(java.lang.String str)
Text
node, with the
supplied string value as its 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 java.lang.String getText()
Text
node as a Java
String
.String
- character content of this node.public java.lang.String getTextTrim()
public java.lang.String getTextNormalize()
public static java.lang.String normalizeString(java.lang.String str)
Per XML 1.0 Production 3 whitespace includes: #x20, #x9, #xD, #xA
str
- string to be normalized.public Text setText(java.lang.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(java.lang.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 java.lang.String getValue()
public java.lang.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.toString
in class java.lang.Object
String
- information about this node.public Text clone()
All JDOM core classes are Cloneable, and never throw CloneNotSupportedException. Additionally all Cloneable JDOM classes return the correct type of instance from this method and there is no need to cast the result (co-variant return value).
Subclasses of this should still call super.clone() in their clone method.
public Text detach()
Content
This method can be overridden by particular Content subclasses to return
a specific type of Content (co-variant return type). All overriding
subclasses must call super.detach()
;
protected Text setParent(Parent parent)
Content
This method can be overridden by particular Content subclasses to return
a specific type of Content (co-variant return type). All overriding
subclasses must call super.setParent(Parent)
;
public Element getParent()
Content
Element
or a Document
.
This method can be overridden by particular Content subclasses to return
a specific type of Parent (co-variant return type). All overriding
subclasses must call super.getParent()
;
Copyright © 2021 Jason Hunter, Brett McLaughlin. All Rights Reserved.