Talk:Document type declaration

This is an old revision of this page, as edited by SineBot (talk | contribs) at 10:31, 2 June 2011 (Signing comment by 203.171.97.75 - "HTML5: new section"). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Latest comment: 14 years ago by 203.171.97.75 in topic HTML5

Doctype semantics

Anonymous edits from 217.140.228.85 removed these claims (which were mine), saying they were misunderstandings:

  • The DOCTYPE declares the document as being of 'type' "html" (or whatever the root element is declared to be).
    • This was removed altogether, and made to say that the DOCTYPE just includes a DTD by reference. I concede that the original phrasing wasn't the way I really intended to express things, but I did mean to say more than just that there's a reference to a DTD. I meant to say that the DOCTYPE declares the document as being of a particular 'type' as defined by two pieces of information: a particular DTD, and a clarification of which element type declared in the DTD must be used as the root element, since DTDs are sometimes ambiguous in this regard. Would you disagree with that?
      • I would not disagree with the two pieces of information but I do disagree with them being characterized as the "type" of the document. People tend to understand as the "type" of the document having values like HTML, DocBook, TEI, etc. -- The maker of the anon edits
  • The root element, if given in the DOCTYPE, must match the document's actual root element.
    • This got changed to just say that the root element is declared to be "html" (in the example). With the original phrasing, I wanted to imply that the root element did not necessarily need to be given (in XML, at least, it is optional, although I believe it was an oversight in the grammar) and also that there is a validation requirement associated with it: in XML, at least, if the root element is named in the DOCTYPE, then the name of the document's actual root element must match. Is this irrelevant?
  • The SYSTEM identifier is used when the DTD cannot be obtained via the PUBLIC identifier.
    • This was changed to say that a processor may use either ID, as it chooses, to know what DTD to use. I think you're correct; I had assumed, based on a particular catalog implementation, that public IDs were preferred when both were available.

mjb 20:39, 30 October 2005 (UTC)Reply

Anonymous edits from User:99.35.179.251 removed some previously researched stuff saying "The HTML5 doctype doesn't care about your root element".

  • No, but when it does appear while in the XHTML syntax or in any polyglots, XML rules, which _do_ care about the root element, also apply. RobSimpson (talk) 18:24, 2 September 2009 (UTC)Reply
    • <!doctype HTML:html> is invalid in polyglots, as section 9.1.1 of the HTML 5 working draft clearly specifies. The removed text implied that it was somehow relevant to HTML 5, and not just XHTML 5; this is certainly incorrect. Your example appears to be valid in XHTML 5, but only because XHTML 5 follows XML's definition of a doctype. If it would be useful to note this example, it should probably be in a section that generically deals with XML.

      (BTW, I'm not 99.35.179.251 – we were discussing this at irc://irc.freenode.org/whatwg and both corrected some errors at the same time.) —Simetrical (talk • contribs) 03:24, 3 September 2009 (UTC)Reply

doctype 4.0 transitional

Netscape Composer 4.77 insists on generating HTML that starts:

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">

but 4.0 is not listed as among current doctypes. And these statements are supposedly case sensitive, and the proper form of this statement is apparently:

<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">

but whether correcting case that way does any good is not clear, since the current validators may not recognize 4.0 as valid in any event. Which all leaves open the question of how various real-world browsers treat such HTML webpages. What is the optimum way to hand patch the doctype in code generated by 4.77? Tidy seems to want to change it to XHTML 1.0:

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

It's all pretty weird, considering that many millions of webpages must have been generated by 4.77, and many must still be floating around in cyberspace. 69.87.199.253 00:15, 18 January 2007 (UTC)Reply

Yes that is weird. however, the validator accepts 4.0 trans, as long as you capitilize it correctly.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

works. Bawolff 02:46, 2 February 2007 (UTC)Reply

XHTML Print

Doesn't XHTML Print have a DTD too? --Stefán Örvarr Sigmundsson 03:37, 28 October 2007 (UTC)Reply

HTLM 5 Doctype

Shouldn't we clarify that the HTML 5 doctype can also be written with HTML in lower case, like this:

<!DOCTYPE html>

HTML5

In the HTML5 section, regarding the following sentence:

"This would be a problem whenever the document is supposed to be consumed by text/html parser as well as by XHTML (application/xhtml+xml) parsers."

Normally documents are only parsed as the document type. If it's an XML document, why would it be parsed as text/html (and visa-versa)? — Preceding unsigned comment added by 203.171.97.75 (talk) 10:29, 2 June 2011 (UTC)Reply