I have an xml like this...
<object>
<list name="subscriptions">
<object>
<string name="id">feed/http://feeds.feedburner.com/computerdefense</string>
<string name="title">.:Computer Defense:.</string>
<list name="categories">
<object>
<string name="id">user/14761688561595773457/label/Hacking</string>
<string name="label">Hacking</string>
</object>
</list>
<string name="sortid">7372F971</string>
<number name="firstitemmsec">1240520939961</number>
<string name="htmlUrl">http://www.computerdefense.org</string>
</object>
<object>
<string name="id">feed/http://www.rawseo.com/news/feed/</string>
<string name="title">A blend of programming and seo</string>
<list name="categories">
<object>
<string name="id">user/14761688561595773457/label/Hacking</string>
<string name="label">Hacking</string>
</object>
</list>
<string name="sortid">D6766911</string>
<number name="firstitemmsec">1258495136927</number>
<string name="htmlUrl">http://www.rawseo.com/news</string>
</object>
<object>
<string name="id">feed/http://it-adsense.blogspot.com/atom.xml</string>
<string name="title">AdSense Blog-Italiano</string>
<list name="categories">
<object>
<string name="id">
user/14761688561595773457/label/Seo e Web Marketing
</string>
<string name="label">Seo e Web Marketing</string>
</object>
</list>
<string name="sortid">9FB570ED</string>
<number name="firstitemmsec">1233684720758</number>
<string name="htmlUrl">http://it-adsense.blogspot.com/</string>
</object>
<object>
<string name="id">feed/http://feeds.feedburner.com/aextnet</string>
<string name="title">AEXT.NET NET MAGAZINE</string>
<list name="categories"/>
<string name="sortid">70800CFE</string>
<number name="firstitemmsec">1277627346000</number>
<string name="htmlUrl">http://aext.net</string>
</object>
<object>
<string name="id">feed/http://feeds.feedburner.com/alessandroscoscia</string>
<string name="title">Alessandro Scoscia</string>
<list name="categories"/>
<string name="sortid">51CB8E6E</string>
<number name="firstitemmsec">1217001547735</number>
<string name="htmlUrl">http://www.alessandroscoscia.it</string>
</object>
<object>
Can someone show how can I parse it? The text that i need to parse is in body variable
NSMutableString *body = [[NSMutableString alloc]initWithData:responseData encoding:NSASCIIStringEncoding];
I need to insert all info in one Array or in a NSDictionary
Best to use an objective-c parsing library.
This article has a good run down of some of the available ones:
http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project
Also, this page has full code samples using one of the libraries:
http://www.raywenderlich.com/725/how-to-read-and-write-xml-documents-with-gdataxml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With