org.jdom
Class CDATA
- Cloneable, Serializable
public class CDATA
extends java.lang.Object
implements Serializable, 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
.
$Revision: 1.20 $, $Date: 2002/03/12 07:11:39 $- Dan Schaffer
- Brett McLaughlin
- Jason Hunter
- Bradley S. Huffman
protected Object | parent - This
CDATA node's parent.
|
protected String | value - The actual character content
|
CDATA() - This is the protected, no-args constructor standard in all JDOM
classes.
|
CDATA(String str) - This constructor creates a new
CDATA node, with the
supplied string value as it's character content.
|
void | append(String str) - This will append character content to whatever content already
exists within this
CDATA node.
|
void | append(CDATA cdata) - This will append the content of another
CDATA node
to this node.
|
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(Object ob) -
This tests for equality of this
CDATA to the supplied
Object , explicitly using the == operator.
|
Document | getDocument() -
This retrieves the owning
Document for
this CDATA , or null if not a currently a member
of a Document .
|
Element | getParent() - This will return the parent of this
CDATA node, which
is always a JDOM Element .
|
String | getText() - This returns the value of this
CDATA 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.
|
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 Element .
|
CDATA | setText(String str) - This will set the value of this
CDATA node.
|
String | toString() - This returns a
String representation of the
CDATA node, suitable for debugging.
|
parent
protected Object parent
This CDATA
node's parent.
value
protected String value
The actual character content
CDATA
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.
CDATA
public CDATA(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.
append
public void append(String str)
This will append character content to whatever content already
exists within this CDATA
node.
str
- character content to append.
append
public void append(CDATA cdata)
This will append the content of another CDATA
node
to this node.
cdata
- CDATA node to append.
clone
public Object clone()
This will return a clone of this CDATA
node, with the
same character content, but no parent.
detach
public CDATA detach()
Detaches the CDATA
from its parent, or does nothing
if the CDATA
has no parent.
CDATA
- this CDATA
modified.
equals
public final boolean equals(Object ob)
This tests for equality of this CDATA
to the supplied
Object
, explicitly using the == operator.
ob
- Object
to compare to
- whether the
CDATA
nodes are equal
getDocument
public Document getDocument()
This retrieves the owning
Document
for
this
CDATA
, or null if not a currently a member
of a
Document
.
Document
owning this CDATA
, or null.
getParent
public Element getParent()
This will return the parent of this
CDATA
node, which
is always a JDOM
Element
.
Element
- this node's parent.
getText
public String getText()
This returns the value of this CDATA
node as a Java
String
.
String
- character content of this node.
getTextNormalize
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.
- normalized cdata content or empty string
getTextTrim
public String getTextTrim()
This returns the textual content with all surrounding whitespace
removed. If only whitespace exists, the empty string is returned.
- trimmed cdata content or empty string
hashCode
public final int hashCode()
This will generate a hash code for this node.
int
- hash code for this node.
setParent
protected CDATA setParent(Element parent)
This will set the parent of the
CDATA
node to the
supplied
Element
. This method is intentionally
left as
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
clone()
and set it on the desired (new) parent
Element
.
parent
- parent for this node.
setText
public CDATA setText(String str)
This will set the value of this CDATA
node.
str
- value for node's content.
toString
public String toString()
String
- information about this node.
Copyright B) 2002 Jason Hunter, Brett McLaughlin. All Rights Reserved.