The "standard" way to process XML in Javascript is to use one or more standard or broadly available APIs. The most widely adopted APIs for that are:
- DOMParser object, allows for parsing an XML string into a DOM structure
- XMLSerializer object, serializes DOM structure to XML string
- XSLTProcessor object, enables XSLT processing
- XMLHttpRequest object, to send XML over the wire
All of the mentioned objects are available in all of the modern (that are not IE) web browsers. By a lucky occasion, IE has also had implementations of these functionalities since ever (well, since IE5 or so), they just had different APIs. Since mentioned above objects are not available in IE it would be possible to implement them, so did Ample SDK and Sarissa projects, probably some others too.
For example, look how the code that enables cross-browser DOMParser may look:
if (!window.DOMParser) {
var cDOMParser = function(){};
cDOMParser.prototype.baseURI = null;
cDOMParser.prototype.parseFromString = function(sXml, sMime) {
var oDocument = new ActiveXObject("Microsoft.XMLDOM");
oDocument.async = false;
oDocument.validateOnParse = false;
oDocument.loadXML(sXml);
return oDocument;
};
window.DOMParser = cDOMParser;
};