how to read local xml file, where should i put the xml file in the system.
I tired the following code trying to read data.xml. It does not work. Where should I put data.xml in the system.
var f=Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'data.xml');
f.write(this.responseData); // the response you get
var file=Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, "data.xml"),
if(file.exists()){
Ti.API.info('in file ' + file.nativePath);
var fcontent = file.read();
Ti.API.info('contents = ' + contents.text);
}
1 Answer
-
Accepted Answer
var fcontent = file.read(); Ti.API.info('contents = ' + contents.text);
You assigned file content to "fcontent" but reading content from "contents", see the problem?