MultiLevel Parsing using DOM parser – TouchXML

Hello Everyone ! Using this post I am going to describe the most complicated parsing of complex XML data using TouchXML parsing method.

Let’s have a brief idea. Say for example, if you have to parse following xml file. It’s a sample Flickr API response.

URL used to fetch this data is  as follows.

TouchXML for Flickr API

TouchXML for Flickr API

Sample Data Response.

Observe above complex XML ( It is one of the FLICKER API )

You can notice that XML is having Multi-level data. Feed/Entry/Author. Also, most of the tags are having attributes.

Some tages are repeated, for example link tag is repeated under entry tag. So, how are you going to parse them.

Assume that You have to parse & grab all the data. This is just one of the API, there are lot more. You can to write specific code for each different XML responses. It is preferable to generate a re-usable code. I have implemented such a code which can help to parse any kind of XML.

 

Here is the console/NSLog output of parsed dictionary.

Grab the sample code from here.

Leave a Reply

Your email address will not be published. Required fields are marked *



*