• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Convert NSXMLDocument to a NSDictionary?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Convert NSXMLDocument to a NSDictionary?


  • Subject: Re: Convert NSXMLDocument to a NSDictionary?
  • From: Ken Tozier <email@hidden>
  • Date: Sat, 14 Apr 2007 16:37:19 -0400

If you have control of the XML at the URL, you might consider saving the data in property list format then you can use the NSPropertyListSerialization class to pack and unpack NSDictionaries, NSArrays etc. Otherwise, you'll need to initialize an NSXMLParser, set the delegates that interest you and call the "parse" method.

NSPropertyListSerialization documentation here:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ Classes/NSPropertyListSerialization_Class/index.html#//apple_ref/doc/ uid/TP40003716


NSXMLParser documentation here:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ Classes/NSXMLParser_Class/index.html#//apple_ref/doc/uid/TP40003773



On Apr 14, 2007, at 4:30 PM, Lorenzo Thurman wrote:


Is there a simple way of doing this? Cocoa does not seem to provide a
method for doing this, at least nothing within either class seems to fit
the fit the bill. I found this thread in the archives:


http://tinyurl.com/2j9aok

Which leads me to the conclusion that I'll need to write my own parser.
Is that the case?
What I need to do is init a NSXMLDocument with a URL (weather data).
I'd like to then be able to reference the key/pairs via a NSDictionary.
Of course, if there's a better way, feel free to suggest.


TIA

"A good friend will help you move. A really good friend will help you move a body"
--Unknown




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
40comcast.net


This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Convert NSXMLDocument to a NSDictionary? (From: Lorenzo Thurman <email@hidden>)

  • Prev by Date: Convert NSXMLDocument to a NSDictionary?
  • Next by Date: NSPopupButton as pulldown, image problems
  • Previous by thread: Convert NSXMLDocument to a NSDictionary?
  • Next by thread: Re: Convert NSXMLDocument to a NSDictionary?
  • Index(es):
    • Date
    • Thread