-3

I'm a beginner in iOS development, basically an intern at software house. Now my task is to read from an XML file from a URL and implement the contents as a dropdown box in my app. For example, the list of cities of US, or something. I hope you can help me with that.

Looking forward to a reply.

dda
  • 6,030
  • 2
  • 25
  • 34
  • May i know What you have tried? – Prasad G Jul 10 '12 at 11:14
  • Start with all the documentation in Xcode - search for XML and see http://developer.apple.com/library/ios/#documentation/cocoa/Conceptual/XMLParsing/XMLParsing.html#//apple_ref/doc/uid/10000186i – mmmmmm Jul 10 '12 at 11:15
  • Welcome to Stack Overflow. Please take time to read the [FAQ](http://stackoverflow.com/faq). We are here to help, but not to do your work for you. I suggest you start by reading the documentation Apple provide for you (as Mark suggested). This should be your starting point for ANY task you don't yet know. Their documentation is very thorough and contains very detailed example code. Unfortunately a lot of people post questions on here hoping (expecting?) people to give them a chunk of code they can copy into their project. Please don't become one of those people! – Nick Bull Jul 10 '12 at 12:03
  • Thanks for the guidance, I was not hoping to get a copy paste but to help me GUIDE to the way where I am supposed to move. And YES I have written a code of xml parser using NSXML Parser, and now I have a NSMUtable Array of elements but still have a problem with drop down menu, the only alternate is to use a picker, but my employer asks me to populate a dropdown when I click on the corresponding text field – Aleem Ullah Jul 12 '12 at 11:43

2 Answers2

0

You can use an NSXMLParser.Please refer the thread here for an example.

Hope this helps you.

Community
  • 1
  • 1
Mathew Varghese
  • 4,527
  • 2
  • 17
  • 26
0

Depending on the structure that you expect within that XML and/or on how you want to process the data,

NSDictionary* myDictionary = [NSDictionary dictionaryWithContentsOfURL:aURL];

could be, what you are looking for. Debugging and learning from it is easy using

NSLog(@"myDictionary: %@", myDictionary); 

That would display some quite readable data structure (in most cases).

Hermann Klecker
  • 14,039
  • 5
  • 48
  • 71