Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XML DOM data Property

XML DOM data Property


CDATA Object Reference CDATA Object


Definition and Usage

The data property returns the data of the selected node.

Syntax

CDATANode.data


Example

The following code snippet uses loadXMLDoc() to load "books_cdata.xml" Load into xmlDoc, and get data from all elements:

Example

xmlDoc=loadXMLDoc("books_cdata.xml");

x=xmlDoc.getElementsByTagName("html");

for (i=0;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 Object