I’m looking to retrieve an XML document from a private API, then parse it into a table view.
I’ve looked through a few articles but I can’t find anything that has helped me fully.
Does anyone have any articles, tutorials, examples, etc that can help me out?
Thanks in advance!
I’d say this can be split into two problems:
First: Parsing XML
There are two ways to do this: some like event-driven XML; I strongly prefer tree-based XML. You should read a little into each of those tutorials and see which makes the most sense to you; I bet you’ll prefer one of them based on your past programming experiences.
Second: Using Table Views
Once you’ve parsed your XML into some sort of dictionary or custom object, you’ll need to display that object’s information in a table view. For that, I suggest bindings. This CocoaDevCentral tutorial explains how to use bindings to display information in an NSTableView. (It even covers using multiple table views to create a Mail.app-like interface, which you may or may not find useful.)
Or… An Alternative, Less Flexible Method
In the guide for tree-based XML, there’s a section on binding NSXMLDocument objects directly to table views. If you’re sure that you’ll be modifying the XML in such a direct way (for example, if you were writing, say, an XML editor!), then maybe that’s a good idea, and you should check out this sample project. Otherwise, it’ll be inflexible and you’ll have to change it soon as you add features.
Good luck!