What’s the best way to load and process a “two-level nested” plist file using MonoTouch? I have a plist file with data (structurally) similar to the following:
- USA
--- New York
--- Chicago
- UK
--- London
--- Edinburgh
- France
--- Paris
--- Lyon
I have Obj C samples that use NSDictionary and NSArray, but I’d like to get it into a standard C# data structure as quickly as possible. I haven’t been able to locate any complete examples.
You could use the .NET System.Xml libraries to read it, as .plist is simply an XML file. You have the choice of using XPath, looping with
XmlDocument/XmlNode, or maybe even LINQ-To-XML (I’m not sure if this is supported on Monotouch).You can find a lot of XML reading examples out there –
XmlReaderwould be the fastest as it’s forward only.