Sunshine follows rain – GottaGo in the wild

Well.. it took me a while to get here.. And here we are now.

GottaGo is done. (Well, as far as software can be done..) I’m very happy to tell, that GottaGo is ATM. out in the wild for testing and has already been submitted to the AppStore.

Here are some high quality pictures of GottaGo in action:


Well, what has happened so far?

The main problem was the absence of NSXMLDocument/Element. When I started the project, I chose NSXMLDocument over NSXMLParser (SAX) because it’s way easier to handle difficult documents.

Because the app gets its data from Google and SBB over their respective APIs, a flexible XML parser was needed. Especially for SBB. If you’ve ever dealt with the SBB page, you know what I’m talking about.

To my bad, NSXMLDocument was not going to be included in the final SDK – what now?

In the last blog post I mentioned my options. Alea iacta est ;)

First I tried to make it work without a proxy – using IconoraXML but this project was kinda unmaintained and even failed to build. My other approach, to write a wrapper for libxml2 was kinda overdosed.

So I had to rewrite the complete Google and SBB parsing stuff because I screwed up in the first place – this time using NSXMLParser.

What is NSXMLParser – you might ask. It’s actually a SAX parser for Objective-C, which means you look at 1 element at a time. There is no DOM tree or whatsoever. That is a problem if you have hierarchical data – obviously. Let’s say you have 3 train-connections, each with sections.. now how’d you know what section is in which connection if you don’t know about the parent node? I guess you get the point.

If you are really interested, grab the SeismicXML example for the SDK to see how it works in detail. Basically, you just work your way through that Document recursively and always add the stuff you `find’ to your current parent-object. Once you get it, it’s easy to follow..
Sounds like an easy deal, eh? Well, that might be true for the Google data. It was, and that’s what I did.
But SBB? No go. The loader wouldn’t even let me load the html. So what now? – Yes, a proxy was needed – and that’s what was next.

On http://couch.codesofa.com/api/sbb/from/Source1[;Source2 ..]/to/Destination1[;Destination2 ..].xml you see the result (Example). I think this is the first real API available to everyone for SBB.ch .

This was made using the Okapi-Framework with a lot of XPath magic :)

In the next days, I will release the source-code for it, together with an introduction into Okapi since it’s the most basic project I can think of – I just need to polish the code a bit..

So now it was quite easy to parse the SBB data..

Lessons learned? Well, there’s nothing more adorable than a good webservice ;)

What’s next? Favorites and Address book stuff.. But first are some other apps I wanted to get my hands on. (Top secret!)

1 Comment to Sunshine follows rain – GottaGo in the wild

  1. July 19, 2008 at 8:19 am Permalink

    Very cool. Hope the SBB does not block that very soon, otherwise we maybe can find a distributed solution :)

Dare to comment?