Why syndication feed readers (and web browsers) should fail gracefully

December 11, 2008

There are two schools about dealing with errors in pseudo-XML formats like syndication feeds and XHTML: strict failure (the Firefox model, where the user gets a big BZZT dialog) and graceful failure (the Universal Feed Parser model, where you try to get as much as possible out of things). Which school is better is one of those frequently argued things on the Internet.

(Yes, yes, theoretically both syndication feeds and 'XHTML' are real XML and there is only one valid failure mode. This is not true in the real world.)

But it's recently occurred to me that there is a really simple summary of why I think graceful failure is the correct answer. It is this observation:

Strict failure punishes the reader for the sins of the site author.

(And yes, preventing people from reading something that they've expressed an interest in is punishing them.)

Much as the browser is the wrong place to warn about HTML errors, feed readers are the wrong place to complain about invalid feeds. Unless the author reads their feed, those big BZZT dialogs are being shoved in the faces of people who had nothing to do with the problem, which means that you are punishing the wrong people. And my belief is that punishing the wrong people is pretty much always the wrong thing to do.

(The same logic applies directly to browsers dealing with XHTML.)


Comments on this page:

From 65.172.155.230 at 2008-12-12 12:42:34:

But non-strict parsing rewards the bad producer, to the detriment of the good producer.

The most obvious case here is IE happily converting text/plain to text/html, which rewards those bad producers who upload a file called "blah" to their default config. apache-httpd webserver (see it looks fine in IE, and then say firefox must be wrong) and punishes those producers who do the right thing (and want to actually show html, as/in text).

You want to limit (and punish) this behaviuor as much as possible, or what you'll end up with is a giant hack like HTML parsing.

From 98.184.79.155 at 2008-12-13 20:30:01:

I actually like firefox's handling of bad HTML. It put up with all sort of shenanigans when I was writing an html-generating python script, and displayed them just about how I intended. It should be on the content writers to debug their own markup.

Written on 11 December 2008.
« Why you should always allow version 1 to be specified
Two-step updates: the best solution to the valid XHTML problem »

Page tools: View Source, View Normal, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Thu Dec 11 23:02:31 2008
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.