• 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: XML to NSDictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XML to NSDictionary


  • Subject: Re: XML to NSDictionary
  • From: Chris <email@hidden>
  • Date: Fri, 16 Feb 2007 08:01:01 -0800

I am also looking for an example like the one mentioned in the posts bellow. I have been experimenting with parsing an XML file into a NSDictionary, and then working from there. But I am thinking there is a better way.


On Nov 10, 2006, at 11:18 AM, Marc Respass wrote:

I don't want to attach files and send to the list so I'll hit you privately

Marc

On Nov 10, 2006, at 1:36 PM, Alexander Griekspoor wrote:

Thanks Marc and Robert, this was what I was hoping for to hear.

You can, if you don't know, convert to anything with XSLT so you might even convert to an old style ASCII plist. The XML plist is nice because you get data types (numbers, dates, booleans)

This was exactly what I planned to do, instantiate an NSDictionary from this and voila. So the next question, did anyone has ever done this that would be willing to share the XSL stylesheet to transfer a particular xml file into a plist as an example?
Thanks!
Alex



On 10-nov-2006, at 18:25, Marc Respass wrote:

Alex,

I've done this. The XML file that I convert is big and complex and the conversion is very fast (using xerces in Java or the XSL libs in Mac OS X). I'm a huge advocate of using XSLT to convert an XML doc to something useful. XML has this tendency to make people think it's a solution and then come up with the most outrageous and useless document. Use XSLT to convert it to something you can use :).

You can, if you don't know, convert to anything with XSLT so you might even convert to an old style ASCII plist. The XML plist is nice because you get data types (numbers, dates, booleans) but if you don't care then an ascii plist is easier to read and might be a bit easier to build.

Hope this help
Marc

On Nov 10, 2006, at 6:30 AM, Alexander Griekspoor wrote:

Hi,

I have an XML file that I want to convert to a nsdictionary for easy access/enumeration etc. instead of using XPath queries all the time to do lookups (this works but gets rather slow and seems expensive with large xml files). So I was playing with the following thought: would it perhaps be a good plan to do an XSLT operation on the xml document to at once convert it into apple's plist format and use that to instantiate an NSDictionary from? Has anyone ever tried something alike or could comment on whether this would be something smart to do?
Another thing to speed up parsing my xml file would be to use an xslt to remove all unwanted crap from the xml file, after which xpath queries will be much faster I guess? I don't like the xml parser as an alternative for the dom based approach because it gives you so much info to handle that I don't care about (but perhaps not after the xslt based removal of unwanted info that I was thinking about above). Any feedback is welcome.
Alex



*********************************** Mek (Alexander Griekspoor) MekenTosj.com Web: http://www.mekentosj.com Mail: email@hidden ***********************************



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40myth2ipod.com


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


  • Prev by Date: Re: simple regex with NSTask
  • Next by Date: Re: Making a manually polled app loop in games?
  • Previous by thread: How to get a NSPopUpButtonCell bound to a CoreData attribute?
  • Next by thread: Re: XML to NSDictionary
  • Index(es):
    • Date
    • Thread