Wednesday, April 22, 2009

Manual "Refresh" not working anymore? XML Parser issues! Beta?

"Refresh" not working anymore?

Daniel of Bedside fame reported that "Refresh" doesn't work anymore with NewsRob 1.9. It turns out that this is true ;( 

With the last release I added the option "WiFi only" to the auto-sync settings.
Unfortunately the way I implemented it didn't make a distinction between a manual "Refresh" and an auto-sync, which lead to the manual refresh not working, when the auto-sync settings were set to "disabled" or "WiFi only" and no WiFi was available.

Matthias also mentioned yesterday by chat that "Refresh" doesn't work when WiFi is not available and auto-sync is set to WiFi-only. At the time I thought of this more of a feature request, but in the light of the other bug from above I now consider that behavior a bug too.

So the new/changed behavior is that a tap on the "Refresh" button or a trigger from Locale (will be included in an upcoming release) are considered manual refreshs. That means they ignore any setting in the auto-sync preference. 
When auto-sync is triggered by the sync interval set in NewsRob it is an auto-sync and obeys the setting in the auto-sync preference - as it should.

XML parser issues

NewsRob used the kXML pull parser to handle the feed data from Google Reader.
kXML is very small and specifically designed to run on embedded devices like phones. Unfortunately it seems that it is not full-featured what led to a couple of problems.
You can read more details here.

One of the bigger problems surfaced for the first time yesterday and was reported by Gaboo. A consequence of kXML not being able to parse a certain part of the Google Reader input was that the "fetching new entries" phase of NewsRob was interrupted every time, so it renders NewsRob useless. This only happens when there are special characters used in the subscribed feeds and I only know about a single case, but nevertheless there may be more.

I now changed my code to use a DOM parser. This is not a drop-in replacement though, but a deep rework of a central part of NewsRob.
Also I stumbled over another alleged bug in the DOM parser of Android.
As a result I will not release that code yet, but will let it mature a bit more on my phone. As I don't have any other bug reports that we haven't found a workaround for, that should be ok.
If you are a victim of this bug too, let me know. I may help you to find a workaround or release the fix earlier.

So far the fix works great and I haven't had any problems with it. 
If you want to help to test this release with fixes for the both mentioned issues, let me know. I'll send you a version by mail, but you would need to uninstall the current installation of NewsRob to run it.


  1. Hi Mariano,

    Have you tried using the XML parser in WebView? I use it in my app and it makes parsing the feeds very easy. See the function parse_rdf_data_new() in


  2. Hey,

    I don't know if it is such a good idea to branch out to WebView from a service running in the background?!

    Btw. could you run a sample and see if the parser chokes on it?
    Unfortunately I can't post the sample here, as blogger won't accept it.
    Look for the String with the variable name "in".

  3. The WebView's parser seems to work OK with this input. I tested my RSS reader with, and manually inserted the offending line.

    And the feed was displayed the same way as without the inserted line. So I think the XML parser in WebView should be pretty robust.

    My experience with WebView memory usage is quite positive. I use two WebViews in my app -- one for displaying the page to user, the other for running my scripts. So far I haven't seen any memory issues with this usage pattern. I am actually considering adding more WebViews so that when user hits BACK key the previous page can be displayed instantaneously :-)

  4. Thanks for trying that out M., I'll keep that in mind.
    I meanwhile opened a bug report and like to see what will happen to it.

  5. You may want to look at vtd-xml as the state of the art in XML processing, consuming far less memory than DOM


  6. Thanks for the tip. I added it to my TODO list.