- From: Sierk Bornemann <sierkb@gmx.de>
- Date: Thu, 8 Mar 2007 18:03:43 +0100
- To: www-validator@w3.org
Am 08.03.2007 um 11:51 schrieb Swivelgames Support: > Hey, I have recently made 'http://www.swivelgames.com/templates/ > VistaCMS/index.php' valid, but I was kind of shocked when I found > out what I had to do to make it valid. > > If you go there and look at the source, you can see that there is > not end </head> tag, nor is there a <body> tag.. immediately you > would think, thats not valid, but according to the validator it is. > It told me that my source code was not valid when I had the </ > head>, and <body> tags in, and they were in a logical spot. I've > never had this problem, and I always put the tags in the same spot, > and nothing seems to be wrong. > > Please help me figure out why I cant have an end </head> and a > <body> tag in my source code. I would like them to be there. > Go to http://validator.w3.org/ and try to validate your URL by changing manually the DOCTYPE to "HTML 4.01 Strict" rather to let autodetect your Transitional DTD. Then you will get some errors. The Validator behaves correct in saying, that your document with a transitional document type is valid. Why? HTML as an SGML derivate isn't forced to be well-formed (http:// www.w3.org/TR/REC-xml/#sec-well-formed), like XHTML as an XML derivate is (see http://www.w3.org/TR/xhtml1/#h-4.1). HTML follows the looser rules of SGML. The HTML 4.01 Rec, Chapter "3 On SGML and HTML/SGML constructs used in HTML", section "3.2.1 Elements" on http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.1 does explain this. It states, "Some HTML element types allow authors to omit end tags (e.g., the P and LI element types). A few element types also allow the start tags to be omitted; for example, HEAD and BODY. The HTML DTD indicates for each element type whether the start tag and end tag are required." For details on the both elements and their DTDs, which reflect the rules above from a technical view, see: http://www.w3.org/TR/html401/struct/global.html#h-7.4.1 (7.4.1 The HEAD element) http://www.w3.org/TR/html401/struct/global.html#h-7.5.1 (7.5.1 The BODY element) and http://www.w3.org/TR/html401/sgml/loosedtd.html (22 Transitional Document Type Definition) Nevertheless, anybody prevents you from making your document well- formed in HTML 4.01 -- you are strongly encouraged to do so. Or, if nothing speaks against it, switch to a XHTML Document Type -- then you are forced to do so anyway. At least, why don't you use the strict DTD at all? The transitional DTD is only recommended, if you want to use deprecated elements in your document. In all other cases, you are encouraged to use a strict DTD. Sierk -- Sierk Bornemann | Germany email: sierkb@gmx.de WWW: http://sierkbornemann.de/
Received on Thursday, 8 March 2007 17:04:09 UTC