This question already has an answer here:
- How to parse JSON in iOS App 6 answers
Ok,so on my iOS app I have a HTTP Post
method that returns xml
, like this
<?xml version="1.0" encoding="utf-8"?>
<geocode>
<suburb>Sydney</suburb>
<state>NSW</state>
</geocode>
It returns through a HTTP POST
method that gets the Latitude and Longtitude
What I what to do is display this XML
on a button or on a label.
But not the code just like Bold Sydney and less for NSW.
I have the code saved as
NSData *urlData=[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSString *strdata=[[NSString alloc]initWithData:urlData encoding:NSUTF8StringEncoding];
So I usually call on the strdata
to get the XML
but it displays it in its code form and thats the problem. I looked at using NSXMLParser but I couldnt figure out how to use it.
Declare a property like:
And Implement a method like:
And implement the following
NSXMLParser
Delegate methods:Check the following links: