Andreas Sewe wrote:


I don't want to start yet another discussion about violating SHOULD level requirements but I can't think of any better way to handle the following situation (but hopefully you can :-):

Suppose the host www.example.com uses HTTP/1.1's server-driven content negotiation for its resource /img which has both image/png and image/svg+xml representations. Furthermore these representations can be accessed explicitly as /img.png and /img.svg, respectively.

Now a straight-forward way to compose an entry describing /img would be as follows:

<entry>
  <title>Some Example Image</title>
  <summary>A short summary of the example image</summary>
  <link rel="alternate" type="image/png"
        href="http://www.example.com/img.png"; />
  <link rel="alternate" type="image/svg+xml"
        href="http://www.example.com/img.svg"; />
  <content src="http://www.example.com/img"; />
  <!-- author, id, updated -->
</entry>

Note, however, that a type attribute on the content element cannot be used since /img is a negotiated resource -- this violates the SHOULD in 4.1.3.2.: 'If the "src" attribute is present, the "type" attribute SHOULD be provided [...].'

I think this is a good example of why this is a SHOULD and not a MUST. (If Atom allowed an HTTP 1.1 media-range here instead of a MIME media-type you'd be set with "image/*" but it doesn't.) In any case the spec explicitly tells implementors to pay attention to the server:

If the "src" attribute is present, the "type" attribute SHOULD be
  provided and MUST be a MIME media type [MIMEREG], rather than "text",
  "html", or "xhtml".  The value is advisory; that is to say, when the
  corresponding URI (mapped from an IRI, if necessary) is dereferenced,
  if the server providing that content also provides a media type, the
  server-provided media type is authoritative.

So implementors who follow HTTP 1.1 content negotiation should be fine, those who don't will get whatever your default type is. Or should.

--
John Panzer
Sr Technical Manager, AOL
http://journals.aol.com/panzerjohn/abstractioneer

Reply via email to