Skip to content

Instantly share code, notes, and snippets.

@kypflug
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kypflug/dde94c9ac62bc14a9004 to your computer and use it in GitHub Desktop.
Save kypflug/dde94c9ac62bc14a9004 to your computer and use it in GitHub Desktop.
// code for IE
if (window.ActiveXObject || xhttp.responseType == "msxml-document") {
xml.setProperty("SelectionLanguage", "XPath");
nodes = xml.selectNodes(path);
for (i = 0; i < nodes.length; i++) {
document.write(nodes[i].childNodes[0].nodeValue);
document.write("<br>");
}
}
// code for Chrome, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument) {
var nodes = xml.evaluate(path, xml, null, XPathResult.ANY_TYPE, null);
var result = nodes.iterateNext();
while (result) {
document.write(result.childNodes[0].nodeValue);
document.write("<br>");
result = nodes.iterateNext();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment