<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>
Save the tree to the variable xml.
var xml = diputree.save("#xpointer(/)");
Show an alert dialog box with the xml file.
alert (xml);
Instead of using the root ("xpointer(/)"), we could have used the document element ("#/1").