Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid + Phonegap + XML data
    text
    copied!<p>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.</p> <p>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.</p> <p>The synchronization is a HTML with a button. With button clicked, it starts an JS function like this:</p> <pre><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 &gt; 0 &amp;&amp; $(data).find("produtos").eq(0).find("produto").length &gt; 0) { $(data).find("produtos").eq(0).find("produto").each(function() { i++; produtos[i] = "CONSTRUCT SQL STATEMENT WITH XML PARSED DATA LIKE $(this).find('nome').text()"; } } }); </code></pre> <p>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 <a href="https://github.com/phonegap/phonegap-plugins/tree/master/Android/Downloader" rel="nofollow">https://github.com/phonegap/phonegap-plugins/tree/master/Android/Downloader</a> plugin).</p> <p>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.</p> <p>Thank you all!!!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload