This property is a Microsoft extension to the W3C DOM.
Object Attr CDATASection
CharacterData Comment Document DocumentFragment
DocumentType Entity EntityReference Node
Notation ProcessingInstruction Text
Object.xml
The xml property is read-only and 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.
In the following example, the code loads the 'albums.xml' file, and gets the xml
property of the last 'Album' element and displays it.
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>
Code (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
|