Is there a library in Objective-C which I can use in IPhone, in which I can tell in advance the library that these tags it should expect in the xml file and then that library parse it automatically for me and give me an array of NSDictionary in return or something similar?
In simple words, I am looking for something which give me an array of "Object" after it has parse the xml document automatically and I can dictate attributes of that object which it should extract from the document.
I am looking for something similar to this in Objective-C http://code.google.com/p/google-gson/
Though this question was posed more than one year ago, I add my own library licensed under the MIT license which does exactly what we are looking for:
http://ceasyxml.googlecode.com/
TouchXML is easy to use. TouchXML QuickQuide
I hope this answers your question, or give you some insight how you can aproach the problem. You want a simple way to convert your XML data to strong typed classes. Here is how I convert a XMLdata document to an Objective-C item called RSSDataItem. The XMLParser method, parseData takes your NSData from your Url (so its bytedata). I have two methods in my protocol (delegate).
my XMLParser interface (XMLParser.h)
Here is the protocol (delegate methods).
MY Implementation file (*.m)
You should take a look at NSXMLParser and its delegate protocol, NSXMLParserDelegate. It is not as easy as what you described but not too hard to implement either.