XML DOM length property
Definition and Usage
length property returns the number of characters in the selected node.
grammar
CDATANode.length
Examples
The following code fragment uses loadXMLDoc () to " books_cdata.xml " into xmlDoc and get text nodes and data length from the first <title> element:
Examples
xmlDoc=loadXMLDoc("books_cdata.xml");
x=xmlDoc.getElementsByTagName("html")[0].childNodes[0];
document.write(x.data);
document.write(" - Length: ");
document.write(x.length);
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"
Remember, the above is the entire length CDATA sections (<b> Stunning! </ B>) in length, not just the length of the text.
CDATA objects