Last active
August 29, 2015 13:57
-
-
Save tmn/9397926 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var xmlhttp = new XMLHttpRequest(); | |
xmlhttp.open("GET", "test.xml", false); | |
xmlhttp.send(); | |
xmlDoc = xmlhttp.responseXML; | |
var root = xmlDoc.firstChild; | |
var children = root.children; | |
// Eksempel: | |
// children[0]; er lst-noden | |
// children[1]; er result-noden | |
var results = children[1].childNodes; | |
for (var i = 0; i < results.length; i++) { | |
var res = results[i]; | |
for (var j = 0; j < res.getElementsByTagName("str").length; j++) { | |
if (res.getElementsByTagName("str")[j].getAttribute("name") == "title") { | |
console.log("skriv ut tittel: " + res.getElementsByTagName("str")[j].innerHTML); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment