Using the W3C DOM2 Core Recommendation createDocument method and the W3C DOM3 Load And Save Working Draft load method:
var doc = document.implementation.createDocument('','',null);
doc.addEventListener('load', someEventListener, false);
doc.load('theuritothexmlfile.xml');
And when the xml file is loaded, someEventListener(event) is fired.
This is for Gecko-only at the moment (NS6, NS7, Mozilla, Beonex, K-meleon, Galeon, etc).
IE supports its own, proprietary way with a well-publicized ActiveX object:
var doc = new ActiveXObject('Microsoft.XMLDOM');
doc.attachEvent('onreadystatechange', function() { if (event.target.readyState == 4) someEventListener() });
doc.load('theuritothexmlfile.xml');
Also, both browsers implement a proprietary XMLHttpRequest object:
// in IE:
var xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
// in Gecko:
var xmlhttp = new XMLHttpRequest();
And once the object is defined, they both function
accordingly to
http://msdn.microsoft.com/library/de...ttprequest.asp
In Gecko, all methods start with a lowercase letter, and some properties aren't implemented (i.e. use xmlhttp.send() and not xmlhttp.Send())