Re: Help Wanted - better wording for a new warning message (mime type/doctype clash)

On Fri, 2 Mar 2007, olivier Thereaux wrote:

> I've implemented today a little routine checking that a document is served in 
> a media type relevant to the document type detected.

Does this only apply to documents submitted by providing a URL, or to 
documents submitted via file upload (where browsers generally fail to 
include media type information) or via direct input (which amounts to 
submitting as form data submission, which has a known, non-useful media 
type)?

> I would appreciate your 
> help in making the error message a little less awkward than it is now.

I wonder whether the message should just tell what the problem is. The 
problem is, as far as I can understand, the following:

Mismatch between declared media type and declared document type!

The W3C Markup Validator is capable of validating both by SGML rules and 
by XML rules. It makes a guess on which rules should be applied, largely 
on the basis of the Internet media type (also known as MIME type) of the 
document submitted to validation.

Therefore, the Validator sometimes notices a mismatch between the media 
type and the Document Type Declaration, in the sense that some particular 
recommendation suggests that the given media type be not used when 
transmitting the given document type.

> The message currently goes:
> [[
>   * Incorrect Media Type for the Document Type used
>
>     The document is being served as media type application/xhtml+xml, which 
> is not a registered media type for the document type HTML 2.0.
>
>     You should be using a media type such as text/html. Note that using a 
> wrong media type for a certain document type may make the validator and other 
> user agents get confused about the nature of the document, and you may get 
> some erroneous validation errors.
>
> ]]

Well, if that particular case has been detected, then a simple explanation 
would be:

In this case, the declared media type is application/xhtml+xml. It is 
meant to be used for different variants of XHTML. The declared document 
type is HTML 2.0, from the obsolete original HTML specification, for which 
the only recommended media type is text/html.

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

Received on Wednesday, 7 March 2007 11:10:18 UTC