Question

According W3C XML specification, element is declared in form of :

[45]    elementdecl    ::=      '<!ELEMENT' S Name S contentspec S? '>'
[46]    contentspec    ::=      'EMPTY' | 'ANY' | Mixed | children

And samples on w3school is :

 <!ELEMENT br EMPTY>

But in html 4.01 strict dtd element br is :

<!ELEMENT BR - O EMPTY                 -- forced line break -->

Why the second declaration add “- O”? What it means? And Where can I find the offical document about this?

Was it helpful?

Solution

The hyphen means required, the O means optional. So "- O" means that the opening tag is required, and the closing tag is optional. You can read more in §3.3.3

OTHER TIPS

Like @erickson said, the hyphen means "required" and "O" means optional. The first -/O is for the start tag and the second -/O is for the end tag. This is called tag minimization.

Tag minimization is only allowed in SGML DTDs. This is why you see it in the HTML Strict DTD, but you don't see it in the XML Spec or the XML examples on w3schools.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top