XML DOM dataProperty


CDATA object

Definition and Usage

The data property returns the data of the selected node.

Syntax

CDATANode.data

Example

The following code snippet usesloadXMLDoc()put "Load into xmlDoc, and get data from all <html> elements:

Example

xmlDoc=loadXMLDoc("books_cdata.xml");

x=xmlDoc.getElementsByTagName("html");

for (i=0;i<x.length;i++)
{
document.write(x[i].childNodes[0].data);
document.write("
");
}

The code above will output:

Stunning!
Magic! Six stars!
Learn XQuery
Learn XML

Try it Yourself »

CDATA objectother extensions