I would like to know how to parse XML file from local in Titanium App?
var file = Titanium.Filesystem.getFile("Translation1.xml");
if ( file.exists() ) {
Ti.API.info("found");
var xmltext = file.read().text;
var doc = Ti.XML.parseString(xmltext);
// var books = xmlMessage.documentElement.getElementsByTagName("DUAS");
// Ti.API.info(xmltext.length); //Returns 50
Ti.API.info(xmltext); //Returns [Ti.Document
}
else
{
Ti.API.info("not found");
}
}
catch(e)
{
alert(e);
Ti.API.info(e);
}
i get only first line of the file, like following
<?xml version="1.0" encoding="utf-8" ?>
how can i get all the data from that xml file?
You should start by reading the 'Working with XML Data' guide.