Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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);

}

— asked June 14th 2010 by Kyle chang
  • filesystem
  • xml
0 Comments

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?

    — answered June 14th 2010 by Daniel Lim
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.