DTD : Java Glossary

go to home page D words local find full screen, hide local find menu Google search web for more information on this topic jump to foot of page translate this page with Babelfish 2008-03-27 by Roedy Green ©1996-2009 Canadian Mind Products
index page for letter ⇒ punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all)
DTD
Document Type Definition. A carefully structured document that formally defines the syntax of one of the HTML or XML variants using an BNF variant notation. For some reason, the academics who define HTML, think this document, intended for computers, is the way ordinary humans should learn about HTML. A DTD is pretty well incomprehensible until you already fully understand HTML, or have a background in computer language theory.

You need a DTD statement, case-sensitive at the very top of each HTML document, even before the <html>, to tell with version of the HTML grammar you are using.

DTDs are also used with XML. In that case every file format you devise requires its own individually composed DTD to describe what fields are in it.

Here is how to read an DTD tag at the top of each HTML file.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
DTD field Notes
HTML this is HTML, not XML
PUBLIC this is a public standard, not some DTD you cooked up yourself.
W3C who wrote the DTD
HTML 4.01 which version of HTML it supports.
transitional
  • Strict does not let you use features that may be phased out later.
  • Transitional is laxer.
  • Frameset is for when you use <frameset.
EN English
http://www.w3.org/TR/html4/loose.dtd url of the DTD computer-readable grammar
DTD Notes
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html401/strict.dtd"> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
This is what I use on my ordinary documents
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html401/loose.dtd"> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd"> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" 
http://www.w3.org/TR/html4/frameset.dtd">
This is what I use on my frame defining pages
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" 
http://www.w3.org/TR/html401/frameset.dtd"> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN"
"http://www.w3.org/TR/REC-html40/frameset.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml"> 
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd"> 
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
"http://www.wapforum.org/DTD/wml13.dtd"> 
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD WML 2.0//EN"
"http://www.wapforum.org/dtd/wml20.dtd"> 
View a typical DTD definition of an HTML grammar.

Understanding a *.DTD

Here is a DTD that describes the grammar of a JNLP 6.0 file. view A *.DTD file, as opposed to a DOCTYPE that references a DTD at the top of a *.html file, describes the grammar of an html, jnlp or xml file. <!ELEMENT defines a tag and the tags it encloses. EMPTY means the tag does not enclose any data or other tags. An enpty element would normally end with />. + means one or more children, * means 0 or more children, ? means 0 or 1 child. <!ATTLIST describes a keyword="value" option on a tag. CDATA means character data — the value of the attribute is a string. PCDATA means the begin end tags enclose some user data. #IMPLIED means any characters for the field are acceptable, including nothing at all. Did the people who made this up speak English? This has to be one of the goofiest grammars I have ever run across. This is baffling since the job it tackles is trivial.

There are other more-elaborate XML-layout describing languages: XSD, RELAX NG and Schematron.


CMP homejump to top
CMP logo
feedback Please email your feedback for publication, errors, omissions, broken/redirected link reports
and suggestions to improve this page to Roedy Green : feedback email
made with CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[65.110.21.43]
Your face IP:[38.103.63.58]
You are visitor number 11,309.
You can get a fresh copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/dtd.html J:\mindprod\jgloss\dtd.html