On Mar 30, 2006, at 10:30 PM, James M Snell wrote:
Antone Roundy wrote:
[snip]
2) If you're consuming Atom and you encounter a relative URI, how should
you choose the appropriate base URI with which to resolve it?

I think there are only three remotely possible answers to #2: xml:base (including the URI from which the feed was retrieved if xml:base isn't
explicitly defined), the URI of the self link, and the URI of the
alternate link. Given that Atom explicitly supports xml:base, if it's
explicitly defined, it's difficult to justify ignoring it in favor of
anything else.

There is no basis in any of the specs for using the URI of the self or
alternate link as a base uri for resolving relative references in the
content. The process for resolving relative references is very clearly
defined.

Right--my point is:

1) If the original publisher made the mistake of using relative references without explicitly setting xml:base (figuring that consumers could resolve the references relative to the location of the feed), and then the feed got moved or mirrored, one would certainly fail at finding the things the publisher intended to point to if the URI from which the feed was retrieved was used as the base URI, but might succeed by using the self link as the base URI. (I do not advocate doing this as default behavior, as stated below).

2) If the original publisher made the mistake of not even thinking about relative references in the content and therefore didn't set xml:base, the relative references may very well be relative to the location pointed to by the alternate link. For example, the person generating the content may have been thinking "my blog entry will appear at http://example.org/blog/2006/03/foo.html, so I can use the relative URL "../../../img/button.gif" to point to the image at http://example.org/img/button.gif";. If the alternate link points to http://example.org/blog/2006/03/foo.html, then the consumer that wants to find the image will only succeed by using the alternate link as the base URI. (I do not advocate doing this as default behavior, as stated below).

Moral of this story: failing to explicitly set xml:base is bad because it tempts consumers to ignore the spec in order to get what they want. I do not advocate ignoring the spec as default behavior. But honestly, I might give the user of a consuming application the option of overriding the default behavior on specific feeds if they know that the publisher makes the mistake of publishing links relative to the self or alternate link without setting xml:base. I'd LIKE to be able to hold the publisher's feet to the fire and make them fix the feed, but sometimes my users hold MY feet to the fire and make me give them usable workarounds.

Antone

Reply via email to