I'm new to DOM. I want to get the text of the first node with tag title in this xml file http://www.w3schools.com/xml/books.xml , which is Everyday Italian. The answer should be this:
var x = xmlDoc.getElementsByTagName("title")[0].childNodes[0].nodeValue;
From what I see,
xmlDoc.getElementsByTagName("title")[0]
Gets the first title node from an array consisting all nodes of title tag. And if I want to get the text of that node, Shouldn't it be like this?
xmlDoc.getElementsByTagName("title")[0].nodeValue
Why does it have something to do with childNodes ? And what type is this?
xmlDoc.getElementsByTagName("title")[0].childNodes[0]