getElementsByTag not working

Zer0|Darker

New Member
Hi so I have a XML document in a folder on my desktop, I am trying to read out all the elements with the tag name "cuisine". Here is my code:\[code\]if(window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest();}else{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }xmlhttp.open("GET","data.xml", false);xmlhttp.send()xmlData = http://stackoverflow.com/questions/11336132/xmlhttp.responseXML;cuisineList = xmlData.getElementsByTagName("cuisine");document.getElementById("test").innerHTML = cuisineList.length;\[/code\]When I print out the length of the \[code\]cuisineList\[/code\] it says its zero.Here is my XML document:\[code\]<?xml version="1.0" encoding"ISO-8859-1"?><food> <cuisine type="Chinese"> </cuisine> <cuisine type="Indian"> </cuisine></food>\[/code\]
 
Back
Top