TouchXML for the Win!

Last night I implemented saving and loading of the friends list. So now my app is actually useful! I used XML as the file format, because it’s so easy to use and read. Writing the file was easy enough, I just built up an NSString and wrote it out. Reading the file, though, was a different matter. I had previously used the XML reader as in the SeismicXML example, but frankly I didn’t like that method. It was a big pain in the butt. What I wanted was something like NSXMLDocument, which isn’t available on the iPhone. Luckily some wonderful dude created a look-alike library in the form of TouchXML. And some other wonder dude wrote up a RSS tutorial using TouchXML. So after all that, actually reading my XML file became a much easier thing.

Next step? I have lots of little things to do, even now that the basic functionality of my app is working. But I think that maybe now I should actually try to put it onto my iPhone and make sure it works there, and not just in the simulator.

5 Comments

  1. Dean says:

    Hey Mate,
    Dean here from over at dBlog.com.au…

    Glad to see that my TouchXML tutorial helped you out! Good to see other people blogging on their iPhone SDK experiences!

    Keep up the good work,
    -Dean

  2. Henning says:

    Thanks Dean, your tutorial helped a lot!

  3. Louis St-Amour says:

    If you’re the only application to use the data, why not use a plist file instead of XML, it’s built-in and works perfectly — e.g. Save an NSDictionary, get one back. Plus on a Mac you can instantly create them with the Property List Editor and other languages also have plist modules, e.g. Ruby’s plist gem. If targeting 3.0, I’d suggest Core Data also/instead, because NSFetchedResultsController is so much fun. One of these days, I should write a tutorial for an NSFetchedResultsController implementation of SearchResultsControllerDelegate, as I just figured it out yesterday, and it highlights the simplicity of using FetchedResultsController with Core Data instead of managing your own data source manually. If interested, feel free to email me at LSTA at yorku dot ca, which will encourage me to write it up.

  4. henning says:

    Yeah that’s what I do now. Back then, I didn’t know. :)

  5. Louis St-Amour says:

    Cool, I figured as much. I was writing more to clue others in — it’s likely why TouchXML is read-only, you shouldn’t use XML for your internal storage, but you may need to parse it from elsewhere.

Leave a Comment