inessential by Brent Simmons

Postel’s Law, Atom, and NetNewsWire

So a big topic lately has been Atom and Postel’s Law. (Postel’s law is the principle that you should be conservative in what you create and liberal in what you accept.)

Though I haven’t said it publicly before, my plan with Atom support in NetNewsWire is to make the parser stricter than NetNewsWire’s RSS parser.

There are really two levels to this, and I’m talking about the first level.

1. XML errors (unencoded ampersands, string encoding errors, well-formedness errors). If the XML parser NetNewsWire uses returns an error, then NetNewsWire will not try to work around it and parse it anyway.

NetNewsWire’s RSS parser does try to work around some of these errors; the Atom parser will not.

2. Spec errors. Let’s say that Atom 0.6 defines a new element named “foo,” but then NetNewsWire is parsing an Atom 0.5 feed and it contains the foo element. What should NetNewsWire do? Ignore it? Or use it? In this case NetNewsWire might use the element. (Assuming it’s well-formed XML, that is; assuming it passes through #1 above.)

Tim Bray wrote:

An Atom feed is going to be defined as an XML document, which means that if it’s not well-formed then it’s not Atom. All it needs is for one (I repeat, one) popular newsreader with a large installed base to enforce this policy (stop parsing and display an error to the subscriber) to turn this from de jure to de facto reality. This works because Atom doesn’t have an installed base. Let’s name names; if any one of NetNewsWire or FeedDemon or Radio adopted this policy for Atom, it would be game over; people who’ve gotten used to these aggregators are not going to switch clients because some upstream feed producer is a bozo.

That will be NetNewsWire’s policy: if an Atom feed is not well-formed XML, it’s an error.