Character Data

The character data interface provides a set of attributes and methods for accessing the character data nodes. A text node inherit all the functionality of character data.

Data

data character-data
set-data character-data value

The data attribute provides or set the character data of the node.

Length

length character-data

The length attribute returns the number of characters that are available.

Substring Data

substring-data character-data offset count

The substring-data method extracts a range of data from the node. It takes three arguments: The node with the data, an offset for the substring to extract, and the number of characters to extract.

Append Data

append-data character-data arg

The append-data method appends a string to the end of the character data of the node. It takes two arguments: A node, and the string to append to the data of the node.

Insert Data

insert-data character-data offset arg

The insert-data method inserts a string at a specified character offset. It takes three arguments: The node, the offset at which to insert, and a string to insert.

Delete Data

delete-data character-data offset count

The delete-data method removes a range of characters from the node. It takes three arguments: A node, the offset from which to remove characters, and the number of characters to delete.

Replace Data

replace-data character-data offset count arg

The replace-data method replace the characters starting at an offset with a specified string. It takes four arguments: The node, an offset from which to start replacing, the number of characters to replace, and a string.