Hi,
I have an xml file that looks like this:
<?xml version="1.0"?>
<sendSound enable="true" autoPlay="true">
<item name="Gasp for surprise" src="flashsound/gasp.mp3"></item>
<item name="Giggle" src="flashsound/hehe.mp3"></item>
<item name="Say hello" src="flashsound/hello.mp3"></item>
</sendSound>
I want to extract the data to get a list like this on the console logs
Gasp for surprise
Giggle
Say hello
how can I do it with javascript or jquery? This is my code so far:
var users = xml.getElementsByTagName("sendSound");
for(var i = 0; i < users.length; i++) {
var user = users[i];
var names = user.getElementsByTagName("item");
for(var j = 0; j < names.length; j++) {
console.log(names[j].getAttribute("name"));
}
}
Thank you.
XMLHttpRequestdeveloper.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/…