This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 5197 - warning about nonexistent content-type for XHTML 1.1 doctype with html mime type
Summary: warning about nonexistent content-type for XHTML 1.1 doctype with html mime type
Status: RESOLVED FIXED
Alias: None
Product: Validator
Classification: Unclassified
Component: Types Registry (show other bugs)
Version: 0.8.2
Hardware: Macintosh MacOS X
: P2 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: qa-dev tracking
URL: http://www.enhanceability.com/strateg...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-15 06:14 UTC by Ron Stone
Modified: 2007-10-17 02:45 UTC (History)
1 user (show)

See Also:


Attachments

Description Ron Stone 2007-10-15 06:14:12 UTC
The URL 'http://www.enhanceability.com/strategies/7X05.html' contains the following types:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<meta http-equiv="content-type" content="application/xhtml+xml;charset=utf-8" />


Because the document is valid XHTML 1.1 and also because the 'http-equiv' 'content-type' ACTUALLY IS "application/xhtml+xml", this looks like a validator bug.

That the '.html' file extension (mime type) is used for an XHTML 1.1 doctype doesn't mean that the 'content-type' is 'text/html'.


--- begin w3c validator warning v0.8.2 'http://validator.w3.org/check?uri=http%3A%2F%2Fwww.enhanceability.com%2Fstrategies%2F7X05.html'---

Conflict between Mime Type and Document Type
The document is being served with the text/html Mime Type which is not a registered media type for the XHTML 1.1 Document Type. The recommended media type for this document is: application/xhtml+xml

Using a wrong media type for a certain document type may confuse the validator and other user agents with respect to the nature of the document, and you may get some erroneous validation errors. How to fix this problem? One of the following techniques should help:

If you are serving a static file on a Web server, changing its extension should help. Use e.g .xhtml for XHTML or .mathml for MathML.
You may need to reconfigure your Web server. This Setting up MIME Types tutorial has instructions for Apache, Tomcat and IIS.
If the document is generated dynamically, the scripting language should allow you to set up the mime type: this article on MIME Types and Content Negotiation has examples in PHP, Perl, and ASP.

--- end w3c validator warning v0.8.2 'http://validator.w3.org/check?uri=http%3A%2F%2Fwww.enhanceability.com%2Fstrategies%2F7X05.html' --- 


At the same time, are browsers and web servers ready for '.xhtml', '.xht', or '.xml' file extensions? Some preliminary tests show some inconsistent results for more than a few recent version browsers.

Ideally, it would be nice to be able to code xhtml1.1 'application/xhtml+xml' Media Type documents with .xhtml or .xht file extensions so that those documents could be displayed by current version browsers.

And wouldn't the same steps for configuring web servers to serve .xhtml or .xht files also be able to accommodate the serving of documents with .xml file extensions? 

Given the constantly changing web, shouldn't the browsers and servers be mapped/filtered/parsed so that webmasters can decide which file extensions to use, especially if the documents validate to the standards?

Ron
Comment 1 Olivier Thereaux 2007-10-15 06:21:44 UTC
(In reply to comment #0)
> The URL 'http://www.enhanceability.com/strategies/7X05.html' contains the
> following types:
> 
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
> "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
> 
> <meta http-equiv="content-type" content="application/xhtml+xml;charset=utf-8"
> />
> 
> 
> Because the document is valid XHTML 1.1 and also because the 'http-equiv'
> 'content-type' ACTUALLY IS "application/xhtml+xml", this looks like a validator
> bug.

No. 
- what the validator is talking about is the HTTP Content-Type header
- the HTTP Content-Type header always has precedence over the <meta> information (which, at least for the media type, some might argue is plain useless).

$ HEAD http://www.enhanceability.com/strategies/7X05.html
200 OK
Connection: close
Date: Mon, 15 Oct 2007 06:19:39 GMT
Accept-Ranges: bytes
ETag: "9edb46-3d8e-4702a77f"
Content-Length: 15758
Content-Type: text/html
Last-Modified: Tue, 02 Oct 2007 20:18:07 GMT
Client-Date: Mon, 15 Oct 2007 06:19:45 GMT
Client-Peer: 216.39.58.63:80
Client-Response-Num: 1




> At the same time, are browsers and web servers ready for '.xhtml', '.xht', or
> '.xml' file extensions? Some preliminary tests show some inconsistent results
> for more than a few recent version browsers.

Extensions don't matter, and servers can be configured. Browsers are another story, and indeed serving XHTML as application/xhtml+xml doesn't work for IE.

If you don't need ruby annotation, stick to XHTML 1.0 (which can be served as text/html, although browsers will then parse it as "legacy" HTML) or HTML 4.01.
Comment 2 Ron Stone 2007-10-15 08:12:54 UTC
Comment #1 (In reply to comment #1)

> No. 
> - what the validator is talking about is the HTTP Content-Type header
> - the HTTP Content-Type header always has precedence over the <meta>
> information (which, at least for the media type, some might argue is plain
> useless).
> 

Yes, that is the point, that the validator warns about a nonexistent content-type for XHTML 1.1 doctype with html mime type. 

There is no 'text/html' as claimed in the "Conflict between Mime Type and Document Type" message.



> Extensions don't matter, and servers can be configured. Browsers are another
> story, and indeed serving XHTML as 'application/xhtml+xml' doesn't work for IE.

Though isn't IE7 blogged to support the parsing of valid XHTML anyway? 
And many other browsers do support  'application/xhtml+xml' documents. 

> If you don't need ruby annotation, stick to XHTML 1.0 (which can be served as
> text/html, although browsers will then parse it as "legacy" HTML) or HTML 4.01.
> 

XHTML 1.1 is more interoperable with more XML. There may be more reasons for not needing to use XHTML 1.0 that are beyond the matter of an invalid "Conflict between Mime Type and Document Type" message. 

The "Conflict between Mime Type and Document Type" message does not address an XHTML 1.1 validation issue. And the message moreover does not provide useful information about coding documents for standards compliance. 

Because the "Conflict between Mime Type and Document Type" message is not valid, the bug is still a bug.
Comment 3 Olivier Thereaux 2007-10-16 00:54:28 UTC
(In reply to comment #2)

> Yes, that is the point, that the validator warns about a nonexistent
> content-type for XHTML 1.1 doctype with html mime type. 
> 
> There is no 'text/html' as claimed in the "Conflict between Mime Type and
> Document Type" message.

There is :)
Here are the HTTP headers sent by your server:

$ HEAD http://www.enhanceability.com/strategies/7X05.html
200 OK
Connection: close
Date: Mon, 15 Oct 2007 06:19:39 GMT
Accept-Ranges: bytes
ETag: "9edb46-3d8e-4702a77f"
Content-Length: 15758
***** Content-Type: text/html *****
Last-Modified: Tue, 02 Oct 2007 20:18:07 GMT
Client-Date: Mon, 15 Oct 2007 06:19:45 GMT
Client-Peer: 216.39.58.63:80
Client-Response-Num: 1


Comment 4 Ron Stone 2007-10-16 17:41:13 UTC
> There is :)
> Here are the HTTP headers sent by your server:
> 

Thanks for the information. I need to do some more testing with the new server settings. 
Comment 5 Ron Stone 2007-10-17 02:45:11 UTC
> 

Just one addititional comment, possibly a feature request:

Perhaps a validator display of the web server HTTP headers for 'Conflict between Mime Type and Document Type' issues might be a little more clearer to users.