XML DOM xml Attribute
Definition and Usage
The xml attribute returns the XML of the node and its descendants.
Syntax:
elementNode.xml
Tips and Notes:
Note:This property is exclusive to Internet Explorer.
Example
In all examples, we will use the XML file books.xml, as well as the JavaScript function loadXMLDoc().
The following code snippet displays the XML of the first <book> element in the XML document:
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName("book")[0];
document.write("<xmp>" + x.xml
+ "</xmp>");
The output of the above code is:
<book category="COOKING"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book>