• 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: NSXMLParser question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSXMLParser question


  • Subject: Re: NSXMLParser question
  • From: Keith Anderson <email@hidden>
  • Date: Thu, 21 Oct 2004 11:38:15 -0700

I just recently went down the same path as you (<http://keeto.net/feed/> for app and source), so I'll chime in with some advice/input...

Yes, not all RSS feeds are well-formed XML. These feeds aren't correct, but if you want to be able to parse them you can't use NSXMLParser (since a real XML parser won't parse a non-well-formed feed).

So what's the purpose of NSXMLParser then?

To parse well-formed XML in an event driven method ;)

In my experience, it's still under development but usable as long as it fits your problem domain. The API is there and (mostly) documented, but several of the methods aren't implemented (yet) and there is some strangeness involved.

That said, it does an admirable job of making it very easy to parse basic XML files - as long as they're well-formed and you don't need much in the way of error reporting (I was unable to get any useful line/position info out of the error delegate methods).

Given that, why are you writing your own RSS parser at all? Brent Simmons has posted open-source code to an RSS parser using CoreFoundation routines. You can find it at <http://ranchero.com/cocoa/rss/>. Note that I haven't looked at it, I'm just assuming it's decent since he's the author of NetNewsWire (and NetNewsWire 2 rocks)

I can't say why, but I checked out the code from Brent.

I also started with Brent's RSS library, but found it lacking. While NetNewsWire does indeed rock, I'm guessing the BSD licensed library is NOT the same version used in NNW. I'm basing this on the fact that malformed XML parsed through that library actually caused crashes while NNW seems to be able to deal with any jumble of RSS tag soup you throw at it.

Nothing against Brent, though - He's trying to make some scratch selling a product, after all. His library allowed me to develop the rest of my application without having to worry about XML parsing - but I eventually replaced it with an implementation using NSXMLParser. While I can no longer parse wildly broken RSS feeds, I now have a stable parser that can dig the info out of any feed that is well-formed. This is an adequate trade-off for me - I just complain to the feed owner that their feed is broken :)

I'm using that instead of NSXMLParser, although it doesn't support the Atom protocol, but I don't think that's used so much.

I actually found Atom parsing to be easier than RSS. The protocol spec is better defined and the feeds tend to be more accurately structured. RSS is a mess.

You'd be surprised how many Atom feeds are out there, by the way - and no point excluding them if you're writing a reader... If you want a framework to use in the meantime, there is an LGPL framework at http://www.daikini.com/source/atom.framework/ - but you have to be careful how you put those two libraries together in your app. Or don't ever release ;)

Cheers,
Keith

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

This email sent to email@hidden
References: 
 >NSXMLParser question (From: Jesus De Meyer <email@hidden>)
 >Re: NSXMLParser question (From: Kevin Ballard <email@hidden>)
 >Re: NSXMLParser question (From: Jesus De Meyer <email@hidden>)

  • Prev by Date: Re: [Newbie] Looking for local newbies in Boston
  • Next by Date: Auto-resize NSTableView Row
  • Previous by thread: Re: NSXMLParser question
  • Next by thread: Re: NSXMLParser question
  • Index(es):
    • Date
    • Thread