Monday, 9 February 2015

Objective C parsing



I'm trying to parse a very easy XML file but I cannot get how the NSXMLParse works... Here the XML file:





<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE addresses SYSTEM "addresses.dtd">
<addresses owner="Andrea">
<person>
<lastName>Doe</lastName>
<firstName>John</firstName>
<phone location="mobile">(201) 345-6789</phone>
<email>jdoe@foo.com</email>
<address>
<street>100 Main Street</street>
<city>Somewhere</city>
<state>New Jersey</state>
<zip>07670</zip>
</address>
</person>
<person>
<lastName>Pippo</lastName>
<firstName>Pluto</firstName>
<phone location="mobile">0039212121</phone>
<email>pippo@foo.com</email>
<address>
<street>Via dalle palle</street>
<city>In the middle of nowhere</city>
<state>BZ</state>
<zip>6969</zip>
</address>
</person>



I just need to create an NSArray that stores the person object and I think that the address object will be an NSDictionary....


Any idea how to do it in simple way?


Thanks everybody


No comments:

Post a Comment