BizTalk Utilities CV ,   Jobs ,   Code library
Go to the front page to continue learning about XML or select below:


ReBlogger Contents

Previous posts in XML

Page 11356 of 21350

Implementing Atom Publishing Protocol, Part 5.5

Blogger : meta-douglasp
All posts : All posts by meta-douglasp
Category : XML
Blogged date : 2006 Nov 27

Simon Fell just left me a little Objective-C/Cocoa hint in the comments to my last post.

I have been trying out a lot of feed readers in the past months and I somehow lost his entry, but I have now re-subscribed (I have settled on Google Reader, of course).

It looks like he has a good case of the Objective-C addiction too.

To return the favor...  Simon: I use Quicken on the Mac.  It is nothing like Money.  Worth spending money on (pun intended).

Based on Simon's advice, the new API is:

@interface AtomClient : NSObject

    -(XmlDocument*) feedAt: (NSURL*) aURL;
    -(XmlElement*) addEntry: (XmlElement*) anEntry to: (NSURL*) aURL;
    -(XmlElement*) addEntry: (NSData*) aNSData with: (NSString*) aContentType to: (NSURL*) aURL;
    -(XmlElement*) entryAt: (NSURL*) aURL;
    -(void) deleteEntryAt: (NSURL*) aURL;
    -(void) updateEntryAt: (NSURL*) aURL with: (XmlElement*) anEntry;
    -(void) updateEntryAt: (NSURL*) aURL withData: (NSData*) aNSData;


Note that I decided to use my "dots over XML" code from a previous post (Slash-dot Problem, Part 4) rather than "statically typed" feed and entry classes.  This still let's me do:

    AtomClient* client = [AtomClient new];
    XmlDocument* feed = [client feedAt: [NSURL URLWithString:@"http://foo/atom"]];
    NSLog("Last title=%@", [[[feed entry] objectAtIndex:0] title]);

The issue is going to be support for "set" values, which I need to add.

Lastly, I am also adding the below subclass to handle the Google's Account Authentication for Installed Applications (I am sure that there will be more such additions):

@interface GDataClient : AtomClient

    -(id)initWithUser: (NSString*) aUserId
                        password: (NSString*) aPassword
                        error: (LoginError**) anError;
    -(id)initWithUser: (User*) aUser error: (LoginError**) anError;

Read comments or post a reply to : Implementing Atom Publishing Protocol, Part 5.5
Page 11356 of 21350

Newest posts

    Email TopXML