Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <script> function loadXMLDoc(dname) { if (window.XMLHttpRequest) { xhttp=new XMLHttpRequest(); } else { xhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET.html",dname,false); try {xhttp.responseType="msxml-document"} catch(err) {} // Helping IE xhttp.send(""); return xhttp; } var x=loadXMLDoc("books.xml"); var xml=x.responseXML; path="/bookstore/book/title"; // 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(); } } </script> </body> <!-- Mirrored from www.w3schools.com/xpath/tryit.asp?filename=try_xpath_select_cdnodes by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 07:32:32 GMT --> </html>
Result:
Try it Yourself - © w3schools.com