<html>
<head>
<title>example</title>
<SCRIPT>
function loadTree() {
var diputree = parent.frames["diputree"].document.diputree;
var root = "#xpointer(/))";
var uri = "diputree.xml";
diputree.loadFromURI (root, uri);
diputree.refresh(100);
}
function display() {
var diputree = parent.frames["diputree"].document.diputree;
var xml = diputree.save("#xpointer(/)");
alert (xml);
}
</SCRIPT>
</head>
<body>
<form>
<p>Load the tree:
<p><input type="button" value="load" onClick="loadTree();">
<p>Display XML:
<p><input type="button" value="display" onClick="display();">
</form>
</body>
</html>
Load the xml document in the root.
var root = "#xpointer(/))";
The uri variable contains the URI where document to load is located.
var uri = "diputree.xml";
Call the loadFromURI method.
diputree.loadFromURI (root, uri);
Instead of using the root ("xpointer(/)"), we could have used the document element ("#/1").