Name

deleteData: offset, count

Synopsis

This truncates the DOMString in the data attribute. This method removes count characters, starting at the offset position.

Arguments

offset: unsigned long

The position in the data attribute to remove count characters.

count: unsigned long

The count of characters to remove. If the offset + count is >= the length attribute, the remainder—starting at position offset—is deleted.

Exceptions

INDEX_SIZE_ERR

Raised if the offset parameter is not a valid zero-based index into the data DOMString.

NO_MODIFICATION_ALLOWED_ERR

Raised if the node is read-only.

Java binding

public void deleteData(long offset, long count)
               throws DOMException;

Java example

// Create a new Text object and reference the CharacterData interface
CharacterData ndCD = doc.createTextNode("The truth is not out there.");
     
// change of heart
ndCD.deleteData(12, 4);
     
System.out.println(ndCD.getData( ));

Get XML in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.