Вопрос

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?

Это было полезно?

Решение

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

Другие советы

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top