Re: Puzzled by lack of HTML, HEAD and BODY tags in output

Hi John,

At 15:37 28/07/2004, John Bray wrote:

>I guess I thought that HEAD and BODY were still essential. Certainly
>http://www.w3.org/TR/html401/struct/global.html suggests they are still
>needed, though I've not burrowed into the details of the specification.

Yes, the elements are essential, but the start and end tags are strictly
optional (this is also the case with the elements HTML and TBODY).
That is the meaning of the two 'O's in e.g.
<!ELEMENT HEAD O O ...
(at <http://www.w3.org/TR/html401/struct/global.html#h-7.4.1>)
The first O means that the start tag can be omitted, the second that the
end tag can be omitted. For other elements, both start tag and end tag
are required, e.g.
<!ELEMENT TITLE - - ...

When start and end tags are omitted, an SGML parser infers the presence
of the element with the help of the DTD. But browsers don't contain
SGML parsers, so some get confused by the absence of optional tags.
The above explanation only applies to SGML-based languages (like HTML 4),
not to XML-based languages. Omitting start and end tags is not legal
in XHTML, so Tidy should leave those in.

Regards,
Christophe




>(...)
>John

-- 
Christophe Strobbe
K.U.Leuven - Departement of Electrical Engineering - Research Group 
on  Document Architectures
Kasteelpark Arenberg 10 - 3001 Leuven-Heverlee - BELGIUM
tel: +32 16 32 85 51
http://www.docarch.be/

Received on Wednesday, 28 July 2004 10:19:00 UTC