views:

55

answers:

3

Is it possible to determine the feed type and version in a way so that you can make sure that you have the correct version. At the lowest level so to speak. Namespaces is an obvious approach, but its not present for a lot of feeds.

Any thoughts?

(I'm trying to mashup varioius RSS Feeds).

Thanks in advance for any help!

A: 

I don't know of a clean way. Check out this question for a number of approaches.

Zend_Feed_Reader looks interesting IMO. Maybe it's possible to try and get the feed's version with that.

Pekka
Ok, I will look into those. I want the feed to turn out in a specific way so all the help with parsing and experience from others will be valuable. The first link (and most of all the links in that post looks promising). Thank you!
Fenick
+1  A: 

Given the number of variations, the number of people mixing namespaces (usually to use a full content element in a version of RSS that doesn't have one), and the number of invalid feeds.

No. You'd be better off just getting a good feed parsing library and letting it abstract away all the version issues and building a clean Atom feed from the data you retrieve from it.

David Dorward
That seems to be what I figured. It's so stupid that we keep using such a badly typed format, but what to do? =)Thanks for your input.
Fenick
A: 

Take a look at ROME Project ROME feed parsing library.

It is able to parse a variety of RSS and ATOM syndication feeds and versions and emit whatever syndication feed format/version you want.

ROME is an set of open source Java tools for parsing, generating and publishing RSS and Atom feeds. The core ROME library depends only on the JDOM XML parser and supports parsing, generating and converting all of the popular RSS and Atom formats including RSS 0.90, RSS 0.91 Netscape, RSS 0.91 Userland, RSS 0.92, RSS 0.93, RSS 0.94, RSS 1.0, RSS 2.0, Atom 0.3, and Atom 1.0. You can parse to an RSS object model, an Atom object model or an abstract SyndFeed model that can model either family of formats.

Mads Hansen