I am using xui js in PhoneGap and I want to read xml through xui js.I have written some code and I am getting root Element successfully.And running forloop for each element I am also getting element that is able to display textContent.But I am not able to get further elements inside tags in element.How can I get that.My code is as follows:
xui(window).on('load', function(){
var url="http://www.w3schools.com/dom/books.xml";
fireURL(url,winner);
});
function fireURL(url,success)
{
var option={
async:true,
callback:function(){
success(this.responseText);
}
}
x$().xhr(url,option);
}
function winner(data)
{
domParser = new DOMParser();
var xmlDoc=domParser.parseFromString(data,"text/xml");
x$(xmlDoc).find("book").each(function(element,index){
alert(element.textContent);
//Here I want to get further elements by its tag name
});
}
You can easily use javascript for that.Get reference from Here
Or Replace your success code with following code:-