HTML5: HTML document detected as XHTML due to xmlns attribute, therefore invalid

Hi,
our community has started to write an application with XHTML 1, then 
recently switched to "HTML HTML5". We still have some XML stuff like 
xmlns defined in the html element. Here is what the code looks like 
(test case):

>
> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> 
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
> <title>                        HomePage </title>
> </head>
> <body> </body>
> </html>

The above does not validate using Validate Local HTML. It would validate 
if the validator would fetch the document, since the server transmits a 
"Content-Type    text/html; charset=utf-8" header. Removing the xmlns 
attribute suffices to get this to validate. The following validates:

>
> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" 
> content="text/html; charset=utf-8" />
> <title>                        HomePage </title>
> </head>
> <body> </body>
> </html> 

When validating the first version by direct input, the W3C validator 
reports "Bad value Content-Type for attribute http-equiv on XHTML 
element meta".
The phrasing of this message suggests the validator is interpreting the 
first version as XHTML. This would be caused only by the xmlns 
attribute. However, according to 
http://dev.w3.org/html5/spec/elements.html#global-attributes :

> In HTML, the xmlns attribute has absolutely no effect. It is basically 
> a talisman. It is allowed merely to make migration to and from XHTML 
> mildly easier. When parsed by an HTML parser, the attribute ends up in 
> no namespace, not the "http://www.w3.org/2000/xmlns/" namespace like 
> namespace declaration attributes in XML do.

In other words, the declaration that the document is HTML is considered 
invalid XHTML because the validator interprets the presence of xmlns as 
evidence that the document is XML...

Please copy me on replies.

Received on Monday, 5 September 2011 13:07:25 UTC