By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,226 Members | 1,373 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,226 IT Pros & Developers. It's quick & easy.

DOCTYPE Statement

P: n/a
I manually code my HTML without using any page generating
software. I need to know how to specify the DOCTYPE at the
beginning of my HTML files.

No, I don't want a "canned" DOCTYPE statement. I want to
understand what the different fields mean so that I can tailor
them to what I am really doing.

--

David E. Ross
<http://www.rossde.com/>

I use Mozilla as my Web browser because I want a browser that
complies with Web standards. See <http://www.mozilla.org/>.
Jul 20 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
David Ross wrote:
I manually code my HTML without using any page generating
software. I need to know how to specify the DOCTYPE at the
beginning of my HTML files.

No, I don't want a "canned" DOCTYPE statement. I want to
understand what the different fields mean so that I can tailor
them to what I am really doing.


http://www.w3.org/QA/2002/04/valid-dtd-list.html

HTML 2.0 / 3.2 - obsolete
HTML 4.01 - best choice for most documents
XHTML 1.0 - HTML 4.01 expressed in XML instead of SGML. Might be useful if
you plan to process your documents with XML tools.
XHTML 1.1 - as 1.0 Strict with a couple of things removed and Ruby added.
Generally unsuitable for sending to clients.
MathML - for representing equations in XML - poor client support
SVG - for representing vector graphics in XML - poor client support

For XHTML 1.0 and HTML 4.01:
Frameset - for frameset documents. Avoid.
Transitional - includes obsolete presentational markup. Avoid.
Strict - Recommended.

For specifics, see http://w3.org/TR/html4/ , the .dtd files and
http://validator.w3.org/
These documents might help you understand the specs:
* http://www.w3.org/TR/REC-html40/intro/sgmltut.html
* http://www.alistapart.com/articles/readspec/
--
David Dorward <http://dorward.me.uk/>
Jul 20 '05 #2

P: n/a
David Ross <no****@nowhere.not> writes:
I manually code my HTML without using any page generating
software.
What would be the advantage (taking a very liberal approach for the
interpretation of 'page generating software' -- after all, typing can
introduce as much errors as click and drool devices :-)?
I need to know how to specify the DOCTYPE at the
beginning of my HTML files.
If you actually want to learn something, I'd strongly suggest the
opposite approach: start with a declaration, and then use editing
software that can parse it and assist you in creating corresponding
documents. (X)Emacs does that.

There's hardly any point in sticking a declaration on top of documents
that have already been authored.
No, I don't want a "canned" DOCTYPE statement. I want to
understand what the different fields mean


The meaning of 'the different fields' has been successfully obfuscated
by doctype sniffing implementations and has largely become of historical
interest only. By now, it's exactly what you say:
*canned* 'statements' (or actually: 'processing instructions').
For the historical interest:
<http://groups.google.com/groups?selm=58o91m%24j3s%40client3.news.psi.net>
--
| ) 111010111011 | http://bednarz.nl/
-(
| ) Distribute me: http://binaries.bednarz.nl/mp3/aisha
Jul 20 '05 #3

P: n/a
DU
David Ross wrote:
I manually code my HTML without using any page generating
software. I need to know how to specify the DOCTYPE at the
beginning of my HTML files.

No, I don't want a "canned" DOCTYPE statement. I want to
understand what the different fields mean so that I can tailor
them to what I am really doing.


Like the others who replied to you, best is to know and use what is the
most recommendable and recommended doctype declaration. Whatever you do,
I suggest and strongly recommend you use a doctype declaration which
will trigger MSIE 6 for windows (by far, currently the most popular
browser in use on the web) into standards compliant rendering mode
because this is where your documents can get the most thanks to a doctype:
- more consistent rendering across all W3C web standards compliant
browsers, closer rendering to other W3C web standards compliant browsers
(like Opera, Mozilla)
- speed of parsing and rendering
- correct implementation of the CSS1 box model

These documents, I believe, will answer your question:

http://msdn.microsoft.com/workshop/a...asp?frame=true

http://msdn.microsoft.com/library/en...cements_topic2

Activating the Right Layout Mode Using the Doctype Declaration
http://www.hut.fi/u/hsivonen/doctype.html

DU
Jul 20 '05 #4

P: n/a
Eric B. Bednarz <be*****@fahr-zur-hoelle.org> wrote:
The meaning of 'the different fields' has been successfully
obfuscated by doctype sniffing implementations and has largely
become of historical interest only. By now, it's exactly what you
say: *canned* 'statements' (or actually: 'processing
instructions').


I'd say it's even worse than that, in a sense - they are just magic
_strings_ sniffed by the wowsers. They simply compare the strings with
some builtin table of strings they have, perform some unspecified
string matching algorithm (which is close to exact match but not
quite), and then proudly select "quirks mode" (intentionally erroneous
mode) or "standard mode" (a mode which lacks some of the intentional
errors and is called "standard" just to complete the confusion).

But on the other hand, if someone wants to use a validator, then the
correct document type definition is all-important. But understanding
that starts from DTDs, not from a particular way to refer to them.
The HTML 4.01 specification is one starting point when trying to
understand the HTML 4.01 DTDs, although most of what it says about SGML
is vague.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #5

P: n/a
Okay, here is what I have so far. Using the DOCTYPE for HTML 4.01
transitional:
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

1. DOCTYPE: This is the type of the declaration

2. HTML: Are there other possible values for this field?

3. PUBLIC: What is this?

4. "-//W3C//DTD HTML 4.01 Transitional//EN": This is a compound
item, with sub-items separated with // --
a. -: ??
b. W3C: This is the organization that maintains the HTML and
CSS specifications. Are there other possible values for this
sub-item?
c. DTD HTML 4.01 Transitional: This identifies the type as
HTML 4.01 Transitional. I have seen other values.
d. EN: The language on the HTML page is English. Note:
Using a <meta> tag to specify the language is considered an error
by validity checkers.

5. http://www.w3.org/TR/html4/loose.dtd: This is where the HTML
4.01 Transitional type is described. All of compound item #4 is
contained in the first non-comment line of the file at this URL.
I question why this redundancy exists.

--

David E. Ross
<http://www.rossde.com/>

I use Mozilla as my Web browser because I want a browser that
complies with Web standards. See <http://www.mozilla.org/>.
Jul 20 '05 #6

P: n/a
David Ross <no****@nowhere.not> writes:
2. HTML: Are there other possible values for this field?
<!DOCTYPE p PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<p lang="en">Most certainly.
3. PUBLIC: What is this?
A public identifier is floating around somewhere next door:
4. "-//W3C//DTD HTML 4.01 Transitional//EN"
You don't really want to be forced to open a http connection for
validation (see below).
a. -: ??
'Unregistered' is rather self-documenting, no? Take e.g.:

<!DOCTYPE HTML PUBLIC "ISO/IEC 15445:2000//DTD HTML//EN">
b. W3C: This is the organization that maintains the HTML and
CSS specifications. Are there other possible values for this
sub-item?
You can put in your own name for whatever you own.
d. EN: The language on the HTML page is English.
Arrgh. No. The language of the item with the public text class DTD is
English.
Using a <meta> tag to specify the language is considered an error
by validity checkers.
For document instances, using the META element type for whatever purpose
can generally be considered bogus, but I don't see what validation has
to do with that.

The document language should be declared with the LANG attribute for the
root element (see above).
5. http://www.w3.org/TR/html4/loose.dtd: This is where the HTML
4.01 Transitional type is described.
It depends on your understanding of type description. That surely is
where the bulk of the syntax is declared, short of the SGML declaration.
Any semantics of a document type can't be expressed formally (surprise).
Without corresponding text in human language, P is most likey the name
token to denote a parking space.
All of compound item #4 is
contained in the first non-comment line
Que?
of the file at this URL.
I assume you mean 'in the first comment declaration'. A comment is
whatever is enclosed by a pair of the com delimiter '--' within a markup
declaration (starting with markup declaration open (MDO) '<!'; in the
case of comment declarations (what is usually referred to as 'comment'
in document instances) MDO must be followed by the first com delimiter
immediately. But in the (in this case external) declaration subset
comments are also used *within* Markup declarations (like ELEMENT type,
ATTLIST, ENTITY, etc).
I question why this redundancy exists.


SGMLized HTML? SCNR

If validation has any real purpose for you, you'll want the external
declaration subsets referenced by the system identifier on your local
system. Then you make a catalog file that maps the public identifiers
to the paths of your local files, declare the system identifier to be
overridden by the public identifier and there you go. If no such
mapping exists, you can fall back to the system identifier and retrieve
it from its location.

Of course you are free to introduce lots of mistakes when setting up
your own catalog; but then, you can as well make your own mistakes than
let other people do that for you (witness the HTML 4.0 system identifier
resolving to the HTML 4.01 declaration subset; no problem if you
validate with the w3c validator because the FPI is mapped to the correct
file).
--
| ) 111010111011 | http://bednarz.nl/
-(
| ) Distribute me: http://binaries.bednarz.nl/mp3/aisha
Jul 20 '05 #7

P: n/a
David Ross wrote:
Okay, here is what I have so far. Using the DOCTYPE for HTML 4.01
transitional:
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
2. HTML: Are there other possible values for this field?


It is the root element of the document. So, <!DOCTYPE HTML is for HTML,
<!DOCTYPE svg is for SVG (XML is case sensitive), etc.

Jul 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.