[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [syndication] Re: robots.txt and rss



Jeff Barr wrote:
> Thanks Phil and Dave, this is very helpful info. I will dig into this very
> soon. I just took a look at the code and the RSS version is determined by:
>
> 1 - the version attribute
> 2 - The URI of a DTD
> 3 - An xml namespace reference to http://purl.org/rss/1.0/
>
> If done by DTD, the DTD URI is mapped to a version per the following
table:

<snip/>

> Is there a better way to do this?

Unless I'm forgetting about some version, you should be able to do it in
just one split: if the feed contains an <rss> element, then it has to be
0.9x/2.0, and every version in that flavor has required a version attribute,
so either it's the version in the attribute, or it doesn't have a version
attribute and it's not a valid RSS file. If it has an <rdf:RDF> element,
then the namespace for the <channel> element (which is required, so there
better be one) is either http://purl.org/rss/1.0/ and it's a 1.0 feed, or
it's http://my.netscape.com/rdf/simple/0.9/ and the feed is 0.90. If it
doesn't have any of those three things, you could probably make a guess at
what version it would be closest to if it were a valid RSS feed by looking
at the DTD if it has one, but for me at least it would be more useful to
know that "x% are invalid" than to know that some of the things in the 0.9x
version counts aren't really valid 0.9x feeds, they just happen to use an
0.9x DTD, and that some of the things counted as 1.0 could be invalid
0.9x/2.0 feeds that lack a version number and include the 1.0 namespace for
some random reason.

Phil Ringnalda