Possible Duplicate:
Xml parsing in iOS tutorial
I have XML file in my Xcode project and I want to parse this XML file and show data in UITableView. Since I am new to xml parsing it’s getting difficult for me to do the same. How to parse the below xml?
My xml file is:
<application>
<app_data>
<wayHome>
<data>
<title>159 Darby St Bus Stop</title>
<category>BUS</category>
<lat>-32.9320366</lat>
<long>151.7712731</long>
<image>159 Darby St Bus Stop.png</image>
</data>
<data>
<title>Beaumont St and Denison St Taxi Rank</title>
<category>TRAIN</category>
<lat>-32.9320366</lat>
<long>151.7712731</long>
<image>Beaumont St and Denison St Taxi Rank.png</image>
</data>
<data>
<title>Beaumont St Bus Shop next to ANZ</title>
<category>BUS</category>
<lat>-32.9227304</lat>
<long>151.7472369</long>
<image>Beaumont St Bus Shop next to ANZ.png</image>
</data>
</wayHome>
</app_data>
</application>
Use NSXMLParserDelegate Methods to parse the File.
Use Delegate Methods to parse The File.
I assume that you need to parse the “Data” tags.
Here, you can check that ElementName is “Data” OR NOT. And similar for the innertags of “Data”. Here you can maintain Array OR Dictionary For Data Elements.
so your work is to do in Delegate methods: