Friday, July 15, 2011

XML parser in Objective-C for iPhone Projects (KissXML Parser)

There are many XML parsers for iPhone project :

But here I want to share my view on KissXML Parser, because I have implemented this in all my projects.

Getting started with  KissXML Parser :

1.       Download the API's package for KissXML Parser from here.

2.      Add all files of this package in your project.

3.      Add libxml2.dylib framework in your project.

4.      Do some setting in your project:
         Open application file under Target in left panel of xcode ->  Go To build tab -> set the values of "Other Linker Flags" and "Header Search Paths" as shown in below picture:

5.      Now suppose your xml is in this formate:

     and you want to parse this xml and save it data in an array.

6.   Now open your app.h file and write this code :
 7.   Now open your app.m file and write this code :

Note: Here, this xml is static for static data, you can create your own dynamic xml for dynamic data.