On Jun 2, 5:16 pm, Robert Huff <roberth...@rcn.comwrote:
Can someone offer suggestions why, on the same server (Apache 2.2.8),
this works
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en-US">
<head>
<link rel=stylesheet type="text/css" href="proj_default.css"
title="ss_default">
<title>Testing html</title>
</head>
<body>
<script language="php">
include 'letters/Disclaimer';
</script>
<hr>
<address><a href="mailto:roberth...@rcn.com">Robert Huff</a></address>
<!-- Created: Wed Jan 19 10:52:50 EST 2005 -->
<!-- hhmts start -->
Last modified: Mon Jun 2 16:56:19 EDT 2008
<!-- hhmts end -->
</body>
</html>
but this doesn't:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Testing xhtml</title>
<link rel="stylesheet" type="text/css" href="proj_default.css"
title="ss_default" />
<link rel="icon" type="image/x-icon"
href="images/favicon.png" />
<link rel="shortcut icon" type="image/x-icon"
href="images/favicon.png" />
</head>
<body>
<script type="text/php">
include 'letters/Disclaimer';
</script>
<hr />
<address><a href="mailto:roberth...@rcn.com">Robert Huff</a></address>
<!-- Created: Wed Jan 19 10:52:50 EST 2005 -->
<!-- hhmts start -->
Last modified: Mon Jun 2 17:37:52 EDT 2008
<!-- hhmts end -->
</body>
</html>
"Works" is defined as "the contents of letters/Disclaimer sent to the
browser".
First neither page code is valid. If you copy the codes for each of
the pages and take them to the W3C validator, you can enter the code
directly into a text box. For the html 4.01, you must use <script
type="text/javascript">. Using language only, or at all, is an error
in html 4.01 and all higher versions. However, so far as I know, all
recent popular browsers will forgive this error in html 4.01. On both
of your pages, you write text "last modified --" that is not contained
in a container such as a paragraph. This is an error in html 4.01 and
all above versions. However most popular recent browsers will forgive
this error in html 4.01. So I am not surprised that your html 4.01
page will work on at least most browsers.
For the xhtml 1.1 page, there is a error that the <$xml --- is not at
the top of the page. You might think the validator is crazy, but it is
completely correct. If you look carefully, you will find a space just
before <$xml -- , and thus a space is at the very top of the page.
Xhtml is very literal. Also, when validating at w3c, select to
override the Doctype in your code with the official Doctype for xhtml
1.1 . You will find they are a little different on close comparison. I
never like to copy code from Usenet groups, because too often spaces,
etc get shifted around. Thus some errors can be introduced just by
posting.
It is not difficult to write xhtml 1.1 code after you use it a while,
but very few people serve it
properly with the mime type application/xhtml+xml. On most servers the
extension .html is paired with the mime type text/html. Thus you must
pair the mime type application/xhtml+xml with another extension such
as .xhtml or .xml to serve .xhtml properly. Many people think they are
serving xhtml when they use the code for it served with the
extension .html, but they are only serving html and would thus be
better off serving as html 4.01 strict in the first place. When you
serve properly as xhtml, the page is parsed as xml, and this is as
strict as a mother superior at a convent in the 1800s. Nearly no xml
errors are tolerated, and you just get an error message rather than a
page view. When you serve as html and have even several errors, the
page may still show, although it may or may not look right.
But when you serve a page correctly as true xhtml, no IE browser can
view the page, as Microsoft has never had a browser that can view true
W3C xhtml served properly as application/xhtml+xml. To take care of
IE, you have to use various tricks. One involves rather elaborate
header exchange, using php, with the browser to determine if it will
accept xhtml at all, and if not the xhtml page is converted to html
4.01 strict using regular expressions to remove the xhtmlese such as
self closing tags, etc. There are other methods used to handle IE, but
they all require extra work that would not be required if Microsoft IE
browsers were up to modern W3C standards. Most other popular browsers
will handle true xhtml served properly, although there are still a few
bugs in some, but then there are still even a few html bugs from time
to time. In general, recent Firefox, Opera, Seamonkey, and Safari
browsers handle xhtml serveed properly as application/xhtml+xml
properly.