var isIE = document.all; if(isIE) { var oXmlDom = new ActiveXObject("Microsoft.XMLDOM"); } else { var oXmlDom = document.implementation.createDocument("","", null); Element.prototype.selectNodes = function(sXpath){ var oEvaluator = new XPathEvaluator(); var oResult = oEvaluator.evaluate(sXpath, this, null,XPathResult.ORDERED_NODE_ITERATOR_TYPE, null); var aNodes = new Array; if(oResult!= null) { var oElement = oResult.iterateNext(); while(oElement) { aNodes.push(oElement); oElement = oResult.iterateNext(); } } return aNodes; }; } if(!oXmlDom)oXmlDom = new ActiveXObject("Microsoft.XMLDOM"); function loadXML() { try{ oXmlDom.async="false" if(isIE) { oXmlDom.setProperty("SelectionLanguage","XPath"); } oXmlDom.load("/XML/City.xml"); } catch(e) { var xhr = new XMLHttpRequest(); xhr.open("GET", "/XML/City.xml", false); xhr.send( null); oXmlDom = xhr.responseXML; } }