Name
CharacterData
Synopsis
This interface is a generic one that is
extended by Text, CDATASection
(which extends Text) and
Comment. Any node in a document tree that
implements CharacterData also implements one of
these more specific types. This interface exists simply to group the
string manipulation methods that these text-related node types all
share.
The CharacterData interface defines a mutable
string. getData( ) returns the
“character data” as a
String object, and setData( )
allows it to be set from a String object.
getLength( ) returns the number of characters of
character data, and substringData( ) returns just
the specified portion of the data as a string. The
appendData( ), deleteData( ),
insertData( ), and replaceData(
) methods mutate the data by appending a string to the end,
deleting region, inserting a string at the specified location, and
replacing a region with a specified string.
Figure 21-3. org.w3c.dom.CharacterData
public interface CharacterData extends Node { // Public Instance Methods void appendData(String arg) throws DOMException; void deleteData(int offset, int count) throws DOMException; String getData( ) throws DOMException; int getLength( ); void insertData(int offset, String arg) throws DOMException; void replaceData(int offset, int count, String arg) throws DOMException; void setData(String data) throws DOMException; String substringData(int offset, int ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access