Re: Convert NSXMLDocument to a NSDictionary?
Re: Convert NSXMLDocument to a NSDictionary?
- Subject: Re: Convert NSXMLDocument to a NSDictionary?
- From: Chris Hanson <email@hidden>
- Date: Sun, 15 Apr 2007 17:25:46 -0700
On Apr 14, 2007, at 1: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.
Your question doesn't really make sense as stated. You can treat an
XML property list as a dictionary, since that's really what it's a
representation of, but for arbitrary XML there really can't be any
dictionary representation because Cocoa couldn't know (unless you
supplied it with a schema mapping somehow) how to represent the items
in the XML document as generic property list objects.
That's why NSXMLDocument exists, and is as complex as it is: It is a
full-fidelity representation of the XML document as a tree of
NSXMLNode and NSXMLElement instances, which you can traverse and
modify as appropriate for your needs. If you need to transform it
into a dictionary according to some rules, you need to write the code
to implement that transformation.
-- Chris
_______________________________________________
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