html - 这是有效的 DTD 吗? (官方 html 4.01 dtd)

标签 html dtd

以下声明出现在 html 4.01 dtds 中

<!ELEMENT STYLE - - %StyleSheet        -- style info -->

(参见 http://www.w3.org/TR/REC-html40/sgml/dtd.html 在 strict.dtd 和 loose.dtd 中)

显然,;%StyleSheet 之后丢失了。引用应该是 %StyleSheet;

但这是神圣 html 的官方 dtd - 迄今为止所有 dtd 中最重要的 dtd - 那么那里发生了什么?这样的实体引用是否有效?

最佳答案

在 HTML 4.01 DTD 中没有分号有效。这是 W3C 的 HTML 4.01 Specification - On SGML and HTML 的摘录:

... Instances of parameter entities in a DTD begin with "%", then the parameter entity name, and terminated by an optional ";".

XHTML DTD 中,它不会有效;他们遵循此建议(因为 XHTML 是 XML):Extensible Markup Language (XML) 1.0 (Fifth Edition) - Character and Entity References :

... Definition: Parameter-entity references use percent-sign (%) and semicolon (;) as delimiters.

关于html - 这是有效的 DTD 吗? (官方 html 4.01 dtd),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2858770/

相关文章:

java - 通过 Java SAXParser 解析经过 dtd 验证的 XML 文档时如何解析 "questionmarks"?

html - 将六列 flex 布局转换为三列

javascript - 如何使用javascript验证表单中的数据,然后调用php页面

xml - 我对 DTD 的理解正确吗?

Java XML 解析器添加不必要的 xmlns 和 xml :space attributes

xsd - 免费的 XSD 到 DTD 转换实用程序?

xml - 可选元素类型 DTD

javascript - 在两个 HTML 和 PHP 之间交换变量

html - 文本未与 li ul 中的中心对齐

java - 检测网站的背景颜色