Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MACloop

macrumors 6502
Original poster
May 18, 2009
393
0
Germany
Hi,
I have been using the NSXMLParser class in order to get and handle data for my apps. In my next project, I have total control over the data-setup and it could be possible to get it in xml or csv format. As I never used csv in combination with iphone-app-development, I thought I rather ask if anyone has experience from using csv in iphone-apps? Is it possible at all?

Interesting is:
- which one is the fastest - csv or xml parsing?
- which one is the most robust/reliable to use - csv or xml parsing?
- is there an api for csv parsing? I did not find such an api...
- pros and cons generally...

Any ideas or advices?
Thanks in advance!
MACloop
 
No. You would have to deal with all the parsing yourself. This alone will probably make XML the more attractive choice.

Ok, that is no option! Then I will use the xml parser. I only was curious in order to make the data-handling-process as good as possible. Thanks for you comment!
MACloop
 
One isn't necessarily faster, it purely depends on your traversing algorithms.

XML:

The ability to validate XML makes it more "reliable".
You can easily create contracts for an other parties consumption.
XML is widely supported (lots of nice libs out there for you).
XML is arguably more readable.

CSV:

If you don't have self-describing data, CSV is useful. Such as tabular data without multiple levels of relationships everywhere.
It's lightweight.


In short - stick with XML. You'll have a decent shot of thanking me later. :)
 
One isn't necessarily faster, it purely depends on your traversing algorithms.

XML:

The ability to validate XML makes it more "reliable".
You can easily create contracts for an other parties consumption.
XML is widely supported (lots of nice libs out there for you).
XML is arguably more readable.

CSV:

If you don't have self-describing data, CSV is useful. Such as tabular data without multiple levels of relationships everywhere.
It's lightweight.


In short - stick with XML. You'll have a decent shot of thanking me later. :)

Thanks alot for the comment and the interesting information! Yea - I'll stick with XML :)
 
I would say it depends on what kind of data your looking to pull in. For my application I pull in cards as a csv, with either , or \t seperator. But I do know that I only accept a certain format. But if you are trying to pull in specific information, I would go with XML Which I use in many of my API Calls :)
 
Another fairly standard option is to use JSON formatted data. There are several JSON to Cocoa datatype bridges/converters available, and you can more easily test your server and data using just a browser.
 
Another fairly standard option is to use JSON formatted data. There are several JSON to Cocoa datatype bridges/converters available, and you can more easily test your server and data using just a browser.

Ok, that is cool - do you have a link for some more information on that?
Thanks in advance!
MACloop
 
I found an open source JSON Parser, but I'm at work and I cannot think of the name of it. I'll post it tonight if no here knows what it is.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.