my understanding of doctype is .htm or .html or .xls...?
You're confusing doctype, which is the document type declaration for browsing devices, with file type/extension. Files have little or nothing to do with doctype. For example, a PHP script (.php) will output
a document dynamically. Even though it's file type is .php, the output it sends to the browser can be an XHTML, HTML, or XML doctype (and others too . . . )
The doctype "tells" the browser what mode to render the code in. With a "half doctype" or no doctype (as described by the previous links,) browsers will render in Quirks Mode as opposed to Standards Compliance Mode.
What this means to you as a developer is that some of your CSS rules will fail, or will act differently, the end result being browser differentiation. The first that comes to mind is color assignments; in Quirks Mode f5f5f5 will render as a gray, but it will fail in Standards Compliance Mode because it must be declared with the pound: #f5f5f5. Multiply this by 1000 for all the little quirks (pun intended) with floated objects and box model differences. Standards Compliance mode says "here is how the browser should render, following these rules."
Standards Compliance Mode makes a lot of this stuff go away. It may mean a little learning and figuring out why this or that won't validate, but once you get past it it becomes easier, and wind up saving so much time dealing with silly browser fixes. The one that still stands as odd man out is IE5, and thankfully that nightmare is fading.
You can see the rendering mode of any site, any time; in FireFox, locate some background area, right-click and select Page Info from the context menu.
Most of us output pages that are HTML. Standard, straightforward, HTML - XHTML was really intended to be a cross between XML and HTML, and has a whole different application, the foremost of which is the ability to ex
tend the base HTML element set; create your own document definition to apply tags that give the content context. ( see post #3658661 here [webmasterworld.com].)
When it was first drafted it was thought it would be "the next big thing" but largely it failed . . . and with HTML 5 emerging, it's a sure thing that HTML doctypes are here to stay.
Why not use XHTML? There are many reasons, but many of the things you would normally do are not supported in XHTML - for example, the target attribute for new windows. "bare" elements are not supported, even hidden fields in forms must have a container of some sort. My personal reasoning is that if my document is HTML, I want to TELL the browser it's HTML.