Android PList Parser

Recently I’ve been working on an Android application that uses RESTful services originally designed for the iPhone. As a result, the data from its services use XML PLists. Before working on this project, I’d only briefly encountered PLists when modding my Mac, and had never heard of PList XML until about 2 months ago. PList is a data structure specification created by Apple Inc., and PList XML is an XML representation of PList data. Those who have worked with SOAP may find PList XML at least a little annoying in that it offers similar functionality for mapping data types, without the overhead; but instead of extending SOAP to achieve the same goals Apple chose their own proprietary solution.

To software engineers considering PList XML for their web services: I want to say, “please stop!”. This code is best leveraged when, for example, you can’t control the server-side; or are motivated to use PList XML by a focus on delivering products for Apple platforms. However, when designing RESTful web services for mobile applications I recommend JSON over XML (PList or not) 98% of the time. In short, JSON is more concise, mature, widespread, and BSON ties or wins in debates against binary PList. I also recommend designing systems that don’t care about data types being returned from web services so they’re potentially easier to leverage for web-based clients. Finally, it’s unlikely PList XML would survive if not fueled by Apple’s growth in the market. All these factors can easily disqualify PList from consideration for mobile application architecture.

There’s at least one example of PList parsing with Android on StackOverflow, but I wasn’t able to find an open-source implementation with test coverage, nor one based on SAX. This implementation conforms to the specification (linked above) and will take (most of) the pain out of PList usage for you. It works on Android 1.6 and higher.

Download

The android-plist-parser is available at GitHub:
https://github.com/tenaciousRas/android-plist-parser

Advertisements

One thought on “Android PList Parser

  1. Hi, great work with that plist parser. But i found a problem with it. When the root is an array, the parser throws a NullPointer. Looking the source I finded the philosophy of all your code is for a Dictionary root plist, I tried to modify but if more complex, if i have some time, I will add these feature to your code and send you.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s