Name

length: unsigned long

Synopsis

The size of the DOMString stored in the data attribute. For all methods of this interface that take an index parameter, the valid range for the index is 0 <= index < length. This value can be 0 since it is possible to have an empty CharacterData node. Read-only.

Java binding

public long getLength( );

Java example

// Display the contents of a CharacterData node
CharacterData ndCD = (CharacterData)doc.createTextNode("This string has
 30 characters.");
     
System.out.println("The string \'" + ndCD.getData( ) + "\' has " 
            + Long.toString(ndCD.getLength( )) + " characters.");

Methods

The following methods are defined for CharacterData:

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.