Re: An ignorant SGML question

Earl Hood (ehood@imagine.convex.com)
Tue, 10 Jan 1995 02:18:08 +0100


> Pardon my ignorance on this, but what is the effect of specifying 'O' instead
> of '-' immediately following an element name? The BODY and HEAD elements in
> the HTML3 DTD are defined this way:
>
> <!ELEMENT BODY O O %body.content>
> <!ELEMENT HEAD O O (%head.content)>
^ ^
| |__ End tag minimization
|
|____ Start tag minimization

'O' signifies "optional". '-' signifies "required".

The above decleration states that the begin and end tags of the
BODY and HEAD elements are optional.

Since the begin tags are optional, the SGML parser can determine when
the BODY/HEAD element begins by the appearance of other elements that
the BODY/HEAD element contains.

Example:

<TITLE>This is a title</TITLE>
<H1>H1 Heading</H1>
<P>
Blah Blah Blah
</P>

The beginning of the HEAD element is implied by the existance of the
TITLE element; since the TITLE element can only occur in the HEAD
element.

The closing of the HEAD element and opening of the BODY element is
implied by the H1. H1's cannot appear in HEADs, but it can in BODYs.

I believe the reason why begin tags are optional in BODY and HEAD
elements is too maintain compatiblity with legacy HTML documents.

--ewh