XML DOM » Node » xml

Compability: Internet Explorer

Syntax:
node.xml

This property contains the XML representation of this node and its descendants.

This value for three of the node types, however, is slightly different depending on the nodeValue property. These nodes are:

  • NODE_DOCUMENT_FRAGMENT
    Returns a string representation of all the descendants of the document fragment.
  • NODE_DOCUMENT_TYPE
    Returns a string representation of the !DOCTYPE ... declaration, including the internal subset, if specified.
  • NODE_ENTITY_REFERENCE
    Returns a string representation of the entity reference, but not of its children.

Examples

Code:
XML:

<Albums>
   <Album ref="CD720">
      <category>Pop</category>
      <title>Come On Over</title>
      <artist>Shania Twain</artist>
   </Album>
   <Album ref="CD024">
      <category>cw;</category>
      <title>Red Dirt Girl</title>
      <artist>Emmylou Harris</artist>
   </Album>
</Albums>

VBScript:

Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = True
objXMLDoc.load("albums.xml")

Set Album = objXMLDoc.documentElement.lastChild
document.write(Album.xml)
Output:
&cw;
Red Dirt Girl
Emmylou Harris
Explanation:

In the following example, the code loads the 'albums.xml' file, and gets the xml property of the last 'Album' element and displays it.

Language(s): VBScript XML