CharacterData
interface extends Node with a set of
attributes and methods for accessing character data in the DOM. For
clarity this set is defined here rather than on each object that uses
these attributes and methods. No DOM objects correspond directly to
CharacterData
, though Text
and others do
inherit the interface from it. All offsets
in this interface
start from 0
.
As explained in the DOMString
interface, text strings in
the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In
the following, the term 16-bit units is used whenever necessary to
indicate that indexing on CharacterData is done in 16-bit units.
See also the Document Object Model (DOM) Level 3 Core Specification.
Modifier and Type | Method and Description |
---|---|
public void | appendData(String
The arg)DOMString to append.Append the string to the end of the character data of the node. |
public void | deleteData(int
The offset from which to start removing. offset, int The number of 16-bit units to delete. If the sum of
count)offset and count exceeds
length then all 16-bit units from offset
to the end of the data are deleted.Remove a range of 16-bit units from the node. |
public String | |
public int | getLength()
The number of 16-bit units that are available through |
public void | insertData(int
The character offset at which to insert. offset, String The arg)DOMString to insert.Insert a string at the specified 16-bit unit offset. |
public void | replaceData(int
The offset from which to start replacing. offset, int The number of 16-bit units to replace. If the sum of
count, String offset and count exceeds
length , then all 16-bit units to the end of the data
are replaced; (i.e., the effect is the same as a remove
method call with the same range, followed by an append
method invocation).The arg)DOMString with which the range must be
replaced.Replace the characters starting at the specified 16-bit unit offset with the specified string. |
public void | |
public String | Returns: The specified substring. If the sum ofoffset and
count exceeds the length , then all 16-bit
units to the end of the data are returned.Start offset of substring to extract. offset, int The number of 16-bit units to extract. count)Extracts a range of data from the node. |
appendData | back to summary |
---|---|
public void appendData(String arg) throws DOMException Append the string to the end of the character data of the node. Upon
success,
|
deleteData | back to summary |
---|---|
public void deleteData(int offset, int count) throws DOMException Remove a range of 16-bit units from the node. Upon success,
|
getData | back to summary |
---|---|
public String getData() throws DOMException The character data of the node that implements this interface. The DOM
implementation may not put arbitrary limits on the amount of data
that may be stored in a
|
getLength | back to summary |
---|---|
public int getLength() The number of 16-bit units that are available through |
insertData | back to summary |
---|---|
public void insertData(int offset, String arg) throws DOMException Insert a string at the specified 16-bit unit offset.
|
replaceData | back to summary |
---|---|
public void replaceData(int offset, int count, String arg) throws DOMException Replace the characters starting at the specified 16-bit unit offset with the specified string.
|
setData | back to summary |
---|---|
public void setData(String data) throws DOMException The character data of the node that implements this interface. The DOM
implementation may not put arbitrary limits on the amount of data
that may be stored in a
|
substringData | back to summary |
---|---|
public String substringData(int offset, int count) throws DOMException Extracts a range of data from the node.
|