1

I want to parse the XML data using NSXMLParser. In my root node is location and i want to extract the values for street, city, state and postal_code. I could take the name attribute values and how can i take the inner values of address node.

Here the xml node is,

<location id="10001">
<name>Pugal Devan</name>
 <address>
 <street>112, Jawahar Street </street>
 <city>Kolkata</city>
 <state>West Bengal</state>
 <postal_code>10002</postal_code>
</address>
</location>

Thanks!

asked Apr 7, 2011 at 15:10

1 Answer 1

1

You could create a class that looks like:

@interface Location {
 NSString* name;
 NSString* street;
 NSString* city;
 NSString* state;
 NSString* postalCode;
}

Then just use the normal methods to parse the XML while creating Location objects to hold the parsed data. Here is a very thorough example on how to parse the data.

answered Apr 7, 2011 at 15:19
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.