XML DOM text attribute

Document object reference manual

Definition and usage

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

Syntax:

documentObject.text

Tips and notes:

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

Example

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

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

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

Output:

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

Document object reference manual