Top Description Fields Constructors Methods
org.jdom2

public Class CDATA

extends Text
Class Inheritance
Known Direct Subclasses
org.jdom2.located.LocatedCDATA

An XML CDATA section. Represents character-based content within an XML document that should be output within special CDATA tags. Semantically it's identical to a simple Text object, but output behavior is different. CDATA makes no guarantees about the underlying textual representation of character data, but does expose that data as a Java String.
Authors
Dan Schaffer, Brett McLaughlin, Jason Hunter, Bradley S. Huffman, Victor Toni, Rolf Lear

Field Summary

Modifier and TypeField and Description
private static final long
serialVersionUID

Hides org.jdom2.Text.serialVersionUID.

JDOM 2.0.0 Serialization version.
Inherited from org.jdom2.Text:
EMPTY_STRINGvalue

Constructor Summary

AccessConstructor and Description
protected
CDATA()

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

public
CDATA(final String
the node's character content.
string
)

This constructor creates a new CDATA node, with the supplied string value as its character content.

Method Summary

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

Overrides org.jdom2.Text.append.

This will append character content to whatever content already exists within this CDATA node.
public void
append(final Text
Text node to append.
text
)

Overrides org.jdom2.Text.append.

This will append the content of another Text node to this node.
public CDATA
clone()

Overrides org.jdom2.Text.clone.

Return a deep clone of this instance.
public CDATA
detach()

Overrides org.jdom2.Text.detach.

Detaches this child from its parent or does nothing if the child has no parent.
protected CDATA
setParent(Parent
new parent element
parent
)

Overrides org.jdom2.Text.setParent.

Sets the parent of this Content.
public CDATA

Returns:

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

Overrides org.jdom2.Text.setText.

This will set the value of this CDATA node.
public String

Returns:

String - information about this node.
toString
()

Overrides org.jdom2.Text.toString.

This returns a String representation of the CDATA node, suitable for debugging.
Inherited from org.jdom2.Text:
getParentgetTextgetTextNormalizegetTextTrimgetValuenormalizeString

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.jdom2.Text.serialVersionUID.

JDOM 2.0.0 Serialization version. CDATA is simple

Constructor Detail

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

CDATAback to summary
public CDATA(final String string)

This constructor creates a new CDATA node, with the supplied string value as its character content.

Parameters
string:String

the node's character content.

Exceptions
IllegalDataException:
if str contains an illegal character such as a vertical tab (as determined by org.jdom2.Verifier#checkCharacterData) or the CDATA end delimiter ]]>.

Method Detail

appendback to summary
public void append(final String str)

Overrides org.jdom2.Text.append.

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

Parameters
str:String

character content to append.

Annotations
@Override
Exceptions
IllegalDataException:
if str contains an illegal character such as a vertical tab (as determined by org.jdom2.Verifier#checkCharacterData) or the CDATA end delimiter ]]>.
appendback to summary
public void append(final Text text)

Overrides org.jdom2.Text.append.

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

Parameters
text:Text

Text node to append.

Annotations
@Override
cloneback to summary
public CDATA clone()

Overrides org.jdom2.Text.clone.

Doc from org.jdom2.CloneBase.clone.

Return a deep clone of this instance. Even if this instance has a parent, the returned clone will not.

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.

Returns:CDATA

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
detachback to summary
public CDATA detach()

Overrides org.jdom2.Text.detach.

Doc from org.jdom2.Content.detach.

Detaches this child from its parent or does nothing if the child has no parent.

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();

Returns:CDATA

this child detached

Annotations
@Override
setParentback to summary
protected CDATA setParent(Parent parent)

Overrides org.jdom2.Text.setParent.

Doc from org.jdom2.Content.setParent.

Sets the parent of this Content. The caller is responsible for removing any pre-existing parentage.

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);

Parameters
parent:Parent

new parent element

Returns:CDATA

the target element

Annotations
@Override
setTextback to summary
public CDATA setText(final String str)

Overrides org.jdom2.Text.setText.

This will set the value of this CDATA node.

Parameters
str:String

value for node's content.

Returns:CDATA

the object on which the method was invoked

Annotations
@Override
Exceptions
IllegalDataException:
if str contains an illegal character such as a vertical tab (as determined by org.jdom2.Verifier#checkCharacterData) or the CDATA end delimiter ]]>.
toStringback to summary
public String toString()

Overrides org.jdom2.Text.toString.

This returns a String representation of the CDATA node, suitable for debugging. If the XML representation of the CDATA node is desired, either getText or org.jdom2.output.XMLOutputter#output(CDATA, java.io.Writer) should be used.

Returns:String

String - information about this node.

Annotations
@Override