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.CharacterDatapublic 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 count ) throws DOMException; } ImplementationsComment , Text |