1

I have a NSPopupButton in my view that I would like to fill with various country names. I have an XML file that has all the various countries I need to support which is in a format like so

<?xml version="1.0" encoding="utf-8" ?>
<CountryCodes>
  <option value="Afghanistan" data-alternative-spellings="AF">Afghanistan</option>
  <option value="Åland Islands" data-alternative-spellings="AX Aaland Aland" data-relevancy-booster="0.5">Åland Islands</option>
  <option value="Albania" data-alternative-spellings="AL">Albania</option>
  <option value="Algeria" data-alternative-spellings="DZ">Algeria</option>
</CountryCodes>

I would like to have the popup button bind to this xml file. Is that actually possible, or would I have to first convert the XML into a dictionary or an array and then load it in? If that's the case what would be the best approach for this assuming I have a really large number of option elements with in the xml?

Thanks!

Stavros_S
  • 2,145
  • 7
  • 31
  • 75
  • Where does your XML file come from? Are you saying you know how to save the country data into that XML file but don't know how to put it back into your application? – El Tomato Jun 16 '14 at 22:11
  • @ElTomato The XML file was given to me by another developer, it's used in a windows version of a similar application. The XML will not really change so I just need to bind the popupbutton to this XML data which I have in my xcode project. – Stavros_S Jun 17 '14 at 14:26

0 Answers0