HTML 代码(`<!ENTITY % html.content …>`、`<!ELEMENT …>`、`<!ATTLIST …>`)写在 w3.org 是什么意思?

What does this HTML code (`<!ENTITY % html.content …>`, `<!ELEMENT …>`, `<!ATTLIST …>`) written at w3.org mean?

我正在阅读 the HTML 4.01 specification at w3.org 中 HTML 文档的结构。然后我偶然发现了这段代码;它看起来像某种定义。你们谁能详细说明它的用途和含义吗?

<!ENTITY % html.content "HEAD, BODY">

<!ELEMENT HTML O O (%html.content;)    -- document root element -->
<!ATTLIST HTML
  %i18n;                               -- lang, dir --
>

它是 HTML 4.01 DTD 之一的片段:文档类型定义

请参阅 the tag wiki for ,其中包含更多链接。

DTDs define formal grammars for XML documents: which tags you can use and where you can use them.

HTML 4.01 specification you’re reading has an introduction 概述了规范的结构。

1.1 How the specification is organized

Sections 2 and 3: Introduction to HTML 4

[…]

The brief SGML tutorial gives readers some understanding of HTML’s relationship to SGML and gives summary information on how to read the HTML Document Type Definition (DTD).

第三部分提供了深入的解释:

3.3 How to read the HTML DTD

Each element and attribute declaration in this specification is accompanied by its document type definition fragment. We have chosen to include the DTD fragments in the specification rather than seek a more approachable, but longer and less precise means of describing an element’s properties. The following tutorial should allow readers unfamiliar with SGML to read the DTD and understand the technical details of the HTML specification.