Skip to main content
XMLDocument Property

This topic documents a feature of Binary Behaviors, which are obsolete as of Internet Explorer 10.

Retrieves a reference to the XML Document Object Model (DOM) exposed by the object.


Scripting[ oXMLObject = ] object.XMLDocument

Possible Values

oXMLObject An Object that specifies the XML DOM exposed by the object.

The property is read-only. The property has no default value.


For a complete description of the XML  DOM exposed by the XMLDocument property, see the DOM.

When persistence is applied to an element, a root node is automatically created in the exposed XML document. This node is accessed through the documentElement property. You can use setAttribute to add attributes to the root node, and you can use appendChild to add child nodes to the root node.

The XMLDocument property is available to the saveFavorite behavior and the saveHistory behavior only when the onload event and the onsave event are fired.


This example shows how a persistent object can access the XML DOM through the XMLDocument property. The setAttribute method is exposed through the XML DOM. The setAttribute method is not the same as the Dynamic HTML (DHTML) method and persistence method of the same name.

<META NAME="save" CONTENT="history">
   .saveHistory {behavior:url(#default#savehistory);}
function fnSave(){
   var oXMLDoc=oPersistObject.XMLDocument;
   var oNode=oXMLDoc.createNode(1,"Trunk", "");
   oNode.text="A tree trunk.";
   oXMLDoc.documentElement.insertBefore(oNode, null);
function fnLoad(){
   var oXMLDoc=oPersistObject.XMLDocument;
   var oItem=oXMLDoc.documentElement.childNodes.item(1);
function fnInsTxt(){
   oPersistObject.innerHTML="I am an Ash. I am an Ash sapling."
      + "Well, I am the trunk of an Ash sapling.";
<INPUT TYPE="button" VALUE="Insert Text" ONCLICK="fnInsTxt()">
<A HREF="/workshop/samples/author/persistence/saveTarget_1.htm">
   Leave The Page

Code example:

Applies To

saveFavorite, saveHistory, userData

See Also

Introduction to Persistence