views:

57

answers:

4

Dear folks, I've got an objective-c/cocoa based application that I'm working on. This app is client<->server. Currently, the communcation protocol is based upon some fairly simple XML. While XML works for this task, it is not ideal in any aspect. It's a pain to serialize data to XML, it's not particularly light-weight, and difficult to incorporate non-data information (such as: 'do this next') in.

I'm looking for suggestions to an alternative.

I've considered some of the ones listed here, but haven't decided on any. Suggestions?

+1  A: 

I'm using JSON for an iphone application - I typically would prefer XML, but we needed it very lightweight, so we decided on JSON.

If your working with XML, you should take a look at XPath if you've not already - it will give you tremendous power for extracting values from a XML data structure.

Mr-sk
+1, I hadn't thought of making life easier with xPath. hmmmm
Allyn
+1  A: 

What kind of server do you have? If the server is java based I'd recommend looking at HessianKit by Fredrik Olsson. Encode/Decode to ordinary Objective-C types and put in NSArrays and NSDictionaries will make the experience smoother.

epatel
It's objective-c/cocoa, also written by me
Allyn
@Allyn ObjC on both ends? :) Nice, then if you can to send binary packages how about using NSKeyedArchiver and NSKeyedUnarchiver directly. Put all you want in it and get the NSData and send that, reverse on receiver.
epatel
A: 

What's wrong with (Portable) Distributed Objects?

Stephan Eggermont
I looked into it, but that solution isn't really applicable to my app.
Allyn
+1  A: 

If you are talking to a Objective-C server you can look into encoding and decoding with the preferred serialization methods available in Objective-C.

NSKeyedArchiver and NSKeyedUnarchiver

Basically you will get an NSData from the NSKeyedArchiver that you will send (bytes/length) to the other part and there place it back into an NSData and use NSKeyedUnarchiver to unpack it into objects again.

epatel