January 29, 2002 - Waiting for XML Loading
January 29, 2002 Waiting for XML Loading Tips: January 2002
Yehuda Shiran, Ph.D.
|
<SCRIPT LANGUAGE="JavaScript">
<!--
function load2() {
var xmldoc;
xmldoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
xmldoc.load("mydvd.xml");
alert(xmldoc.xml);
}
// -->
</SCRIPT>
Run it now. You'll get an empty alert box, because the object is not loaded yet. Let's add an assignment to the async property:
<SCRIPT LANGUAGE="JavaScript">
<!--
function load1() {
var xmldoc;
xmldoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
xmldoc.preserveWhiteSpace = true;
xmldoc.async = false;
xmldoc.load("mydvd.xml");
alert(xmldoc.xml);
}
// -->
</SCRIPT>
Run it now. See the whole XML document displayed.