published: November 11th, 2008

Android - Ruby on Rails Project Part 2: Some simple SAX parsing

Must….Finish…..Post…

I’ve been sitting on this post for awhile.  I had the code written weeks ago, but I’ve been procrastinating about getting the surrounding text completed.  As I’ve been trying to get the text written I’ve come up with other ideas, and instead of continually modify the code, I’ll present one solution here, and in my next post I will address one that eliminates the Project POJO.

The goal of this post is to take the nodes of the retrieved XML file from our REST call that I discussed in my early blog post and convert it into an array of concrete objects holding the XML node values as attributes.

This will be done by the following classes and interfaces

1) IObjectTranslator
2) Project
3) AbstractTranslator
3) SaxParser

The methodology discussed is one of many ways to extract objects from an XML document.  And just as a disclaimer to myself, this won’t be any ground breaking stuff, and being a Java programmer who usually has at least desktop processor and memory at his disposal, this may not be the most efficient solution for parsing an XML document on a mobile device, but nested if’s upon nest if’s are a pain to maintain in my most humble of opinions.  Okay, enough futzing around.

(more…)