Talk:Document type declaration

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

&mdash; mjb 20:39, 30 October 2005 (UTC)
 * 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.

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)
 * &lt;!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)

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)
 * Yes that is weird. however, the validator accepts 4.0 trans, as long as you capitilize it correctly.

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

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

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

<!DOCTYPE html>

a short string of markup... ?
The first section is really not well written, and an even bigger issue is: that there has been no effort to make it understandable to laypersons.

In particular the last line of the first paragraph. "It manifests itself as", what is "It"? And what is that "short string of markup"? And no reason to use a verbose and cumbersome expression as: "it manifests itself". I personally don't think that the 'serialized' word should be there. I thought a file/document was by definition serialized? Maybe I'm wrong.

There is smth wrong in section DTD's -> Syntax, in the paragraph beginning with "In XML, the root element ...". It seems like somebody pasted too much in. The last parenthesis is not closed, and it does not really make sense.

Velle (talk) 16:29, 27 August 2011 (UTC)

<!doctype html> for non-HTML5
Should it be noted that <!doctype html> will work - as in push the browser into Standards mode, rather than Quirks mode - for < HTML5 in all browsers with the exception of IE<=5.5? 193.132.145.152 (talk) 14:07, 2 December 2011 (UTC)

XML declaration and quirks mode
Should it be pointed out that by including the XML declaration with the XHTML doctype, the page will render in quirks mode in IE6? Frosteduser (talk) 02:31, 20 May 2012 (UTC)

ALL CAPS
The doctype no longer needs to be capitalized in HTML5, and in articles it's virtually always written in lowercase (in my experience). It's worth considering making it lowercase here as well. 103.5.142.59 (talk) 03:38, 11 April 2014 (UTC)

External links modified
Hello fellow Wikipedians,

I have just modified one external link on Document type declaration. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:
 * Added archive https://www.webcitation.org/68FQUUsTr?url=http://www.whatwg.org/specs/web-apps/current-work/multipage/the-xhtml-syntax.html to http://www.whatwg.org/specs/web-apps/current-work/multipage/the-xhtml-syntax.html

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

Cheers.— InternetArchiveBot  (Report bug) 23:29, 11 September 2017 (UTC)

DTD abbreviation
The DTD abbreviation appears to refer to “Document Type Declaration”(incorrectly) in some instances on this page and “Document Type Definition” (correctly) in other instances. Am I wrong? Marvhen (talk) 20:10, 2 August 2020 (UTC)

DOCTYPE Puzzle
Readers of this page may be interested in thw following discussion: --Guy Macon (talk) 22:37, 1 June 2021 (UTC)
 * Reference desk/Computing