02-17-2003, 05:34 PM
W3's HTML 4.01 DTD uses "- -", "- o" and "o o" in ELEMENT entries between the element name and it's content model. For example:
<!ELEMENT P - o (%inline;)* -- paragraph -->
<!ELEMENT (%heading;) - - (%inline;)* -- heading -->
<!ELEMENT TBODY o o (TR)+ -- table body -->
I've searched the net and can't find any mention of them. And all the XML books I have don't have them. What are they and what do they mean?
02-19-2003, 09:31 PM
The explanation is in the HTML 4.01 spec - it just takes some finding. Here's an excerpt which should show you where to look:
3.3.3 Element declarations
The bulk of the HTML DTD consists of the declarations of element types and their attributes. The <!ELEMENT keyword begins a declaration and the > character ends it. Between these are specified:
1. The element's name.
2. Whether the element's tags are optional. Two hyphens that appear after the element name mean that the start and end tags are mandatory. One hyphen followed by the letter "O" indicates that the end tag can be omitted. A pair of letter "O"s indicate that both the start and end tags can be omitted.
3. The element's content, if any. The allowed content for an element is called its content model. Element types that are designed to have no content are called empty elements. The content model for such element types is declared using the keyword "EMPTY".
In this example:
<!ELEMENT UL - - (LI)+>
* The element type being declared is UL.
* The two hyphens indicate that both the start tag <UL> and the end tag </UL> for this element type are required.
* The content model for this element type is declared to be "at least one LI element". Below, we explain how to specify content models.
This example illustrates the declaration of an empty element type:
<!ELEMENT IMG - O EMPTY>
* The element type being declared is IMG.
* The hyphen and the following "O" indicate that the end tag can be omitted, but together with the content model "EMPTY", this is strengthened to the rule that the end tag must be omitted.
* The "EMPTY" keyword means that instances of this type must not have content.