When I read the HTML 4 Specification.
The document says :
Each markup language defined in SGML is called an SGML application. An SGML application is generally characterized by:
- An SGML declaration.
- A document type definition (DTD).
- A specification that describes the semantics to be ascribed to the markup. This specification also imposes syntax restrictions that cannot be expressed within the DTD.
- Document instances containing data (content) and markup. Each instance contains a reference to the DTD to be used to interpret it.
From above paragraph, My understanding is the HTML
is an SGML application
, Is it right?
And I know there are three types(Traditional, Strict and Frameset) of DTD for the HTML4
(no DTD for HTML5). so for the below sample of Html. What is the DTD type? Thanks.
<Html>
<head>
</head>
<body>
<p>the test html</p>
</body>
</Html>
-
You need to specify the doctype to determine the dtdaggietech– aggietech2014年11月18日 15:07:51 +00:00Commented Nov 18, 2014 at 15:07
1 Answer 1
From HTML 2.0 to HTML 4.01, HTML was nominally defined as an SGML application, as described in the quotation from the HTML 4.01 spec. It was never implemented that way. At least there has never been any published software that actually implements HTML as an SGML application. This is reflected in clause B.3.3 SGML features with limited support of the spec; it described features "that aren't widely supported by HTML user agents", which is a gross understatement; strike out that "widely".
The sample does not contain any document type declaration (doctype
declaration), so it does not specify any DTD. It is not a conforming HTML 4.01 document, since HTML 4.01 requires that one of three document type declarations be used (and it makes the title
element mandatory). Strictly speaking, it is not HTML at all, though browsers will happily treat it as HTML. Formally, that piece of code is an SGML document, since SGML does not require the use of a document type declaration. But as such, it has no meaning; it is pure syntax.
-
The W3C validator definitely implements HTML as an application of SGML. I believe the Amaya web browser does, too. And I heard that Emacs/W3 also does that. So, that's at least two implementations of HTML as an SGML application.Jörg W Mittag– Jörg W Mittag2014年11月19日 00:20:16 +00:00Commented Nov 19, 2014 at 0:20
-
@JörgWMittag, the W3C validator is an not implementation of HTML at all; to the extent that it relates to SGML at all (as opposite to validating by XML rules or by HTML5 rules), it is simply a general SGML validator with very few HTML-specific add-hoc rules, but absolutely no attempt at implementing elements of HTML as defined in HTML specifications. Amaya does not implement HTML as an SGML application; try
<em/foo/
in it to see this. There are have been claims about Emacs/W3 but no verifiable proof of its conformance (though it probably implements some SGML features).Jukka K. Korpela– Jukka K. Korpela2014年11月19日 06:38:16 +00:00Commented Nov 19, 2014 at 6:38 -
@JukkaK.Korpela +1 for the informative.Although I have been in the Web Development many years, but never thought about the behind story of this simple piece of code. Thanks your answer save me. And still need to review the HTML like as in the first time. :)Joe.wang– Joe.wang2014年11月19日 10:00:47 +00:00Commented Nov 19, 2014 at 10:00