I'm developing a cordova/phonegap app and I want to read an xml in order to show some data to user.
I found a way to get my xml file:
getXML.onclick=function(){
var url = 'http://....cloudfront.net/TestFile.xml';
var xmlhttp;
var x,xx,i;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
x=xmlhttp.response;
alert(x); // Here it shows my xml file
for (i=0;i<x.length;i++) {
alert(x[i]); // This shows letter by letter my file
}
}
}
xmlhttp.open("GET",url,true);
xmlhttp.send();
}
So, how should I parse my xml file?
Thanks