TouchCode Rocks

TouchCode is a set of iPhone open source projects that fill in some features that are missing from Cocoa Touch. The most useful part is TouchXML, which is a drop-in replacement for Cocoa’s NSXML* classes.

I was able to get the unmodified ObjectiveFlickr code working by simply doing a global search & replace of NSXMLDocument with CXMLDocument, NSXMLNode with CXMLNode, and NSXMLElement with CXMLElement. The result is less ugly than using NSXMLParser.

For the Official LOLCats application I need to handle RSS feeds, which I found to be exceptionally ugly with NSXMLParser. With TouchXML it’s easy. I can get an array of items with something like this:

NSError *err = nil;
CXMLDocument *doc = [[CXMLDocument alloc]
initWithContentsOfURL: [NSURL URLWithString: @""]
options:0 error: &err];

NSArray *nodes = [doc nodesForXPath: @"//item" error: nil];

1 thought on “TouchCode Rocks”

Leave a Comment