public class CDATA
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
CDATA
represents character-based content within an
XML document represented by JDOM. It is intended to provide a modular,
printable method of representing CDATA. Additionally,
CDATA
makes no guarantees about the underlying textual
representation of character data, but does expose that data as a Java
String
.
Modifier and Type | Field and Description |
---|---|
protected java.lang.Object |
parent
This
CDATA node's parent. |
protected java.lang.String |
value |
Modifier | Constructor and Description |
---|---|
protected |
CDATA()
This is the protected, no-args constructor standard in all JDOM
classes.
|
|
CDATA(java.lang.String str)
This constructor creates a new
CDATA node, with the
supplied string value as it's character content. |
Modifier and Type | Method and Description |
---|---|
void |
append(CDATA cdata)
This will append the content of another
CDATA node
to this node. |
void |
append(java.lang.String str)
This will append character content to whatever content already
exists within this
CDATA node. |
java.lang.Object |
clone()
This will return a clone of this
CDATA node, with the
same character content, but no parent. |
CDATA |
detach()
Detaches the
CDATA from its parent, or does nothing
if the CDATA has no parent. |
boolean |
equals(java.lang.Object ob)
This tests for equality of this
CDATA to the supplied
Object , explicitly using the == operator. |
Document |
getDocument()
|
Element |
getParent()
This will return the parent of this
CDATA node, which
is always a JDOM . |
java.lang.String |
getText()
This returns the value of this
CDATA 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.
|
int |
hashCode()
This will generate a hash code for this node.
|
protected CDATA |
setParent(Element parent)
This will set the parent of the
CDATA node to the
supplied . |
CDATA |
setText(java.lang.String str)
This will set the value of this
CDATA node. |
java.lang.String |
toString()
This returns a
String representation of the
CDATA node, suitable for debugging. |
protected java.lang.String value
protected java.lang.Object parent
CDATA
node's parent.protected CDATA()
This is the protected, no-args constructor standard in all JDOM classes. It allows subclassers to get a raw instance with no initialization.
public CDATA(java.lang.String str)
This constructor creates a new CDATA
node, with the
supplied string value as it's character content.
str
- the node's character content.public java.lang.String getText()
This returns the value of this CDATA
node as a Java
String
.
String
- character content of this node.public java.lang.String getTextTrim()
This returns the textual content with all surrounding whitespace removed. If only whitespace exists, the empty string is returned.
public java.lang.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 CDATA setText(java.lang.String str)
This will set the value of this CDATA
node.
str
- value for node's content.public void append(java.lang.String str)
This will append character content to whatever content already
exists within this CDATA
node.
str
- character content to append.public void append(CDATA cdata)
This will append the content of another CDATA
node
to this node.
cdata
- CDATA node to append.public Element getParent()
This will return the parent of this CDATA
node, which
is always a JDOM
.Element
Element
- this node's parent.public Document getDocument()
This retrieves the owning
for
this Document
CDATA
, or null if not a currently a member
of a
.
Document
Document
owning this CDATA
, or null.protected CDATA setParent(Element parent)
This will set the parent of the CDATA
node to the
supplied
. This method is intentionally
left as Element
protected
so that only JDOM internals use it.
If you need an instance of this CDATA
node with a new
parent, you should get a copy of this node with
and set it on the desired (new) parent
clone()
Element
.
parent
- parent for this node.public CDATA detach()
Detaches the CDATA
from its parent, or does nothing
if the CDATA
has no parent.
CDATA
- this CDATA
modified.public java.lang.String toString()
This returns a String
representation of the
CDATA
node, suitable for debugging. If the XML
representation of the CDATA
node is desired,
either
or
getText()
org.jdom.output.XMLOutputter#output(CDATA, Writer)
should be used.
toString
in class java.lang.Object
String
- information about this node.public final int hashCode()
This will generate a hash code for this node.
hashCode
in class java.lang.Object
int
- hash code for this node.public java.lang.Object clone()
This will return a clone of this CDATA
node, with the
same character content, but no parent.
clone
in class java.lang.Object
CDATA
- cloned node.public final boolean equals(java.lang.Object ob)
This tests for equality of this CDATA
to the supplied
Object
, explicitly using the == operator.
equals
in class java.lang.Object
ob
- Object
to compare toCDATA
nodes are equalCopyright (c) 2016 Software AG. All Rights Reserved.