I have a problem. I want to load an XML file and extract particular nodes from it for displaying using JavaScript.
I have found the following tutorial: http://www.w3schools.com/dom/dom_nodes_get.asp
And based on that I tried my own, but it doesn't work and I don't know what I am doing wrong.
So basically I would like to load a weather forecast in an XML document, for example this one: http://weather.yahooapis.com/forecastrss?w=2442047&u=c
And lets say I want to read the first value, the node "title".
Now based on the tutorial I used the following script:
<!DOCTYPE html>
<html>
<head>
<script src="loadxmldoc.js"></script>
</head>
<body>
<script>
xmlDoc = loadXMLDoc("http://weather.yahooapis.com/forecastrss?w=2442047&u=c");
x = xmlDoc.getElementsByTagName("title");
document.write(x.nodeValue);
</script>
</body>
</html>
But I do not get any result. Could anyone help me where I make the mistake?