Latest web development tutorials

XML DOM data attribute

CDATA Object Reference CDATA objects

Definition and Usage

data property returns the data of the selected node.

grammar

CDATANode.data

Examples

The following code fragment uses loadXMLDoc () to " books_cdata.xml " into xmlDoc, and get data from all <html> element:

Examples

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"

CDATA Object Reference CDATA objects