1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    20
    Vote Rating
    1
    jens13583 is on a distinguished road

      0  

    Default sencha + phonegap: reading local xml file

    sencha + phonegap: reading local xml file


    Is it possible to parse a local xml file when using ST and phonegap on Android (ICS)?

    I tried it with a store
    Code:
    var mystore = new Ext.data.Store({
        model: 'mymodel',
        proxy: {
            type: 'ajax',
            url : 'myfile.xml',
            reader: {
                type: 'xml',
                root: 'myroot',
                record: 'myrecord'
            }
        }
    });
    
    [...]
    mystore.load({
          scope   : this,
          callback: function(records, operation, success) {
            console.log('success: '+success);
          }
    });
    but all I got was an Uncaught TypeError (Cannot read property 'length' of undefined)
    the I tried Ajax.request:
    Code:
      Ext.Ajax.request({
        url: 'myfile.xml',
            success: function() {
    console.log('sucess!!!');
            },
            failure: function() {
    console.log('failure!!!');
            }
          })
    I tried it with a different url:
    Code:
    url: 'file:///android_asset/www/myfile.xml'
    but I had no success.

    Did anyone have the same problem and solved it somehow?

    //edit: On my Android 2.3 device I can use the store + xmlReader without problems, but on 4.0 it just doesnt work ?!?

    //edit2: I tried to put all my js files into one combined js -> still no success

    errors in logcat: SqliteDatabaseCpp: sqlite returned: error code = 14, msg = cannot open file at line [,,,], db=data/data/de.my.app/databases/webview.db
    chromium: Uknown chromium error: -6
    PhoneGapLog: file:///android_asset/www/app/combined.js Line 1 : Uncaught TypeError: Cannot read property 'length' of undefined

  2. #2
    Sencha User
    Join Date
    Oct 2011
    Posts
    20
    Vote Rating
    1
    jens13583 is on a distinguished road

      0  

    Default


    Is there a different method to read files within the apk?

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    20
    Vote Rating
    1
    jens13583 is on a distinguished road

      0  

    Default


    Problem solved after I put the xml file into my app/ subfolder.
    I don't understand why this was a problem on android ICS, but now it works