W3C home > Mailing lists > Public > www-validator@w3.org > August 2008

Re: What is the correct way to do content negotiation?

From: David Dorward <david@dorward.me.uk>
Date: Wed, 06 Aug 2008 13:09:29 +0100
Message-ID: <48999479.3070807@dorward.me.uk>
To: Azu <azumao@gmail.com>
CC: www-validator@w3.org

Azu wrote:
> Basically, what I'm wandering is, how am I supposed to do content 
> negotiation? At first I thought that I was supposed to use the 
> HTTP_ACCEPT header

In general, you are. (Although you should parse it according to the 
spec, and not use one of the overly common scripts that assume that 
because the string of characters "applications/xhtml+xml" appears in the 
header that XHTML is accepted and is preferred to anything else you 
might offer.

, but when I use your validator script at
> validator.w3.org <http://validator.w3.org> to try to test my website in 
> different content types (by using the doctype option), it doesn't change 
> anything in the HTTP_ACCEPT header.

The Doctype Override tells the validator to download the document and 
then change the Doctype (or add one if one is not already present).

Presently the validator does not provide a means to specify accept headers.

> P.S. on a completely different topic; how do I change the options in 
> your validator script without it re-downloading my web page? Like for 
> example if I want to enable verbose output, how do I have it do this 
> without it downloading the page from my server again?

This feature is also not available. In theory a patch could be written 
to enable caching, but I suspect it would cause more problems then it 
would solve given the common sequence of:

1. Test with validator
2. Edit document
3. Go to 1

If a retest used cached data instead of the newly edited data then I 
would expect a lot of people to be confused.

David Dorward                               <http://dorward.me.uk/>
Received on Wednesday, 6 August 2008 12:11:35 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:17:56 UTC