473,386 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

DOCTYPE Statement

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
7 2794
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: CMAR | last post by:
I create my website using Front Page 2000. I notice that none of my pages have a DocType statement at the top. I have read that if you want IE6 to use "Standards mode" rather than the "Quirks...
9
by: Robert Misiorowski | last post by:
Hello, I have a very perplexing (at least to me) problem that hopefully someone can help me with. I'm making a site with a 3 column layout. In the middle column (my fluid column) I am trying to...
25
by: Viken Karaguesian | last post by:
Hello all, I'm somewhat of a newbie to webscripting. I've made a couple of websites in the past with WYSIWYG software, but now I'm much more interested in manual scripting. I have some...
2
by: Rob Meade | last post by:
Hi all, My apologies for this post being perhaps slightly off topic, at work I am only able to access MS newsgroups and I was under to find one perhaps more appropriate. My problem..... ...
5
by: Viken Karaguesian | last post by:
Hello everyone, I have a question about the XHTML doctype. I often times see this statement included in the <html> tag: <html xmlns="http://www.w3.org/1999/xhtml"> If I use the full...
6
by: jperillo | last post by:
When I validate the source of http://www.24stores.com I'm told that I have an incorrect DOCTYPE statement. How can I, or can someone determine what I'm doing wrong !! I have no idea which...
2
by: PapaRandy | last post by:
Hello, I am trying to validate the following .py webpage as HTML (through W3C). I put: ----------------------------------------------------------------------------- print "Content-type:...
15
by: Lennart | last post by:
Hi folks, I have created an animated image gallery in dhtml. It works fine in Internet Explorer. In Firefox, it only works if I ommit the DOCTYPE tag. The page is valid xhtml-strict but with a...
1
by: rfr | last post by:
Apparently the Transitional Doctype kills this script because the script does not make proper use of units like "px". It works well without a doctype statement. But once someone adds a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.