N
Neredbojias
Well bust mah britches and call me cheeky, on Wed, 20 Feb 2008 00:52:41
GMT Beauregard T. Shagnasty scribed:
Here is the php of a page I send to the validator:
<?
header("Vary: Accept");
if (stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) {
header("Content-Type: application/xhtml+xml; charset=utf-8");
echo '<?xml version="1.0" encoding="utf-8"?>';
echo "\r\n";
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
echo "\r\n";
} else {
header("Content-Type: text/html; charset=utf-8");
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
echo "\r\n";
}
?>
The $_SERVER["HTTP_ACCEPT"] line determines if the UA can accept
application/xhtml+xml and if it can feeds it a page with a doctype (et
al) for xhtml 1.1; otherwise the doctype becomes that for xhtml 1.0
strict with a Content-Type of text/html. Ergo, this page which works
fine as xhtml 1.1 - application/xhtml+xml in Firefox can only be
validated as xhtml 1.0 - text/html in the w3c validator.
Here is a test page with the exact php as above. You can try it
yourself:
http://www.neredbojias.com/g3test.php
(Do a view-source after validating.)
The results clearly indicate that the validator does _not_ accept
application/xhtml+xml.
GMT Beauregard T. Shagnasty scribed:
Neredbojias said:Beauregard T. Shagnasty scribed:
Yes, that's what it says, and I think it means the tested page is so
designated. But the _validator page_ is text/html.
Sure. As it should be. It is not a good idea to use
application/xhtml+xml on the web.
Now check "Page Info" (right-click context) in Firefox and see what
content-type is actually rendered (for the validator).
The validator sends as "text/html" as it should. How is that relevant?
You said, "the w3c validator doesn't *accept* the application/xhtml+xml
header." [emphasis mine], which I was rightly disputing.
Here is the php of a page I send to the validator:
<?
header("Vary: Accept");
if (stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) {
header("Content-Type: application/xhtml+xml; charset=utf-8");
echo '<?xml version="1.0" encoding="utf-8"?>';
echo "\r\n";
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
echo "\r\n";
} else {
header("Content-Type: text/html; charset=utf-8");
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
echo "\r\n";
}
?>
The $_SERVER["HTTP_ACCEPT"] line determines if the UA can accept
application/xhtml+xml and if it can feeds it a page with a doctype (et
al) for xhtml 1.1; otherwise the doctype becomes that for xhtml 1.0
strict with a Content-Type of text/html. Ergo, this page which works
fine as xhtml 1.1 - application/xhtml+xml in Firefox can only be
validated as xhtml 1.0 - text/html in the w3c validator.
Here is a test page with the exact php as above. You can try it
yourself:
http://www.neredbojias.com/g3test.php
(Do a view-source after validating.)
The results clearly indicate that the validator does _not_ accept
application/xhtml+xml.