Android + Phonegap + XML data

gulo

New Member
I`m developing a Phonegap Android app that is some kind of catalogue and products search. It have a synchronization with the server intranet, that provides all data.The problem is that the app is all developed, with exception of synchronization that is crashing. I noticed that the problem is with XML parsing.The synchronization is a HTML with a button. With button clicked, it starts an JS function like this:\[code\]$.ajax({ url : "file:///android_asset/xml/produtos.xml", data : "{}", async : false, cache : false, dataType : "xml",}).error(function (xhr, ajaxOptions, thrownError){ alert(xhr.status); alert(thrownError);}).done(function(data) { // search all data, download all files from XML URL tag (used this: https://github.com/phonegap/phonegap-plugins/tree/master/Android/Downloader), construct SQLite statements and throw it in an Array for late DB transaction if($(data).find("produtos").length > 0 && $(data).find("produtos").eq(0).find("produto").length > 0) { $(data).find("produtos").eq(0).find("produto").each(function() { i++; produtos = "CONSTRUCT SQL STATEMENT WITH XML PARSED DATA LIKE $(this).find('nome').text()"; } }});\[/code\]The XML file is very large, about 700kb, with about 1800 products. Each product have about 10 direct nodes inside and about 5 childs with other 10 nodes inside (details, images, related products, etc.). So, each product have about 80 nodes. 1800 * 80 = 144000 nodes in my XML. Also, each product have about 5 URL nodes that are files to download (I'm using https://github.com/phonegap/phonegap-plugins/tree/master/Android/Downloader plugin).If I start the synchronization with downloads, it stops by memory leak (something about 512mb, don't remember the right message, but I can post it tomorrow). If I start the sync without downloads (just XML parse) it takes about 30 minutes and don't do anything (feels like proccessing, but do nothing). I don't know if there is other options to sync this initial data (other syncs are made by passing last sync timestamp by parameter). Do you guys have some problem or (likely) solution? If you need more information, ask me, I need your help with this.Thank you all!!!
 
Back
Top