XML DOM length Property
CDATA Object
Definition and Usage
The length property returns the number of characters in the selected node.
Syntax
CDATANode.length
Example
The following code snippet uses loadXMLDoc() to load "books_cdata.xml" Load into xmlDoc, and from the first
Example
xmlDoc=loadXMLDoc("books_cdata.xml");
x=xmlDoc.getElementsByTagName("html")[0].childNodes[0];
document.write(x.data);
document.write(" - Length: ");
document.write(x.length);
The code above will output:
Stunning!
- Length: 16
Try it »
Please remember that the length above is the length of the entire CDATA section (Stunning!), not just the length of the text.
CDATA Object