save example


HTML document 

<html>

<head>
<title>example</title>
<SCRIPT>
function display() {
 var diputree = parent.frames["diputree"].document.diputree;

 var xml = diputree.save("#xpointer(/)");
 alert (xml);


}
</SCRIPT>
</head>

<body>

<form>

<p>Display XML:
<p><input type="button" value="display" onClick="display();">
</form>

</body>
</html>

Explanation 

Save the tree to the variable xml.

 var xml = diputree.save("#xpointer(/)");

Show an alert dialog box with the xml file.

 alert (xml);

Remarks

Instead of using the root ("xpointer(/)"), we could have used the document element ("#/1").


diputree documentation © 2000 dipu