XML DOM text attribute

Node Object Reference Manual

Definition and Usage

The text attribute can return the text of the node and its descendants.

Syntax:

nodeObject.text

Tips and Comments

Note:This property can only be used in Internet Explorer!

Example

In all examples, we will use the XML file books.xml, and JavaScript functions loadXMLDoc().

The following code can display the text of an XML document:

xmlDoc=loadXMLDoc("books.xml");
document.write(xmlDoc.text;

Output:

Everyday Italian Giada De Laurentiis 2005 30.00
Harry Potter J K. Rowling 2005 29.99 XQuery Kick Start
James McGovern Per Bothner Kurt Cagle James Linn
Vaidyanathan Nagarajan 2003 49.99 Learning XML
Erik T. Ray 2003 39.95

Node Object Reference Manual