?
Solved

Need explanation on why I need a DTD

Posted on 2000-05-06
3
Medium Priority
?
178 Views
Last Modified: 2013-11-19
Can someone explain to me the advantages of using a DTD (Document Type Declaration)?
Do I need to go back to all of my old web pages and add this?
What is it supposed to do FOR my web pages or TO the web browser?
What happens if I don't have one?
Which numeric version should I use?
When I try to verify HTML at web sites, I am frequently told that the web page has problems even though it works, why?
0
Comment
Question by:sduell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
shlomoy earned 200 total points
ID: 2785214
A document type definition (DTD) is a specific definition that follows the rules of the Standard Generalized Markup Language (SGML), and in your case, of XML. A DTD is a specification that accompanies a document and identifies what the funny little codes (or
markup) are that separate paragraphs, identify topic headings, and so forth and how each is to be processed. By mailing a DTD with a document, any location that has a DTD "reader" (or "SGML compiler") will be able to process the document and display or print it as intended. This means that a single standard SGML compiler can serve many different kinds of documents that use a range of different markup codes and
related meanings. The compiler looks at the DTD and then prints or displays the document accordingly.

As a matter of fact, the document you are looking at is coded in a particular DTD called HTML.
In this case, the "compiler" or document handler is your Web browser which is designed to handle text documents encoded with HTML tags. (Other programs could be developed that would handle HTML and other DTDs as well.)

IBM and many large and small corporations are converting documents to SGML, each with its own company document type definition or set of definitions. For corporate intranets and extranets, the document type definition of HTML provides one new "language" that everyone can format documents in and read universally.

---------------------------------------

And now, to your questions:

In case you use HTML, no you don't really need a DTD.

In case you use XML, You probably do.

The DTD tells the probram which parses your document (a browser, for example) how to understand the code (HTML for example).

In case you don't have a DTD, you count on the parser on the user's side to be able to "guess" the DTD you use. In the case of HTML, all browsers know to guess that your HTML pages use the HTML DTD. In case you use other type of XML, the guessing wouldn't probably be good.

The numeric version of the DTD really depends on the type of code you write. in case HTML is involved, version 3.2 or 4.0 are the latest.
An example of a DTD decleration for using HTML 3.2:
<!doctype html public "-//W3C//DTD HTML 3.2//EN">

Most browsers tend to understand even BADLY WRITTEN HTML documents.
Reason is, HTML doesn't have really to be "by the rules" (according to the DTD), and browsers do a rather good job, understanding even bad HTML files.
Hopefully, using HTML 4.0 and newver versions of HTML, using a DTD decleration would be a must, hence forcing people to write VALID HTML DOCUMENTS.

I hope this answers all your questions.
0
 
LVL 2

Author Comment

by:sduell
ID: 2785399
Thank you.
0
 
LVL 8

Expert Comment

by:shlomoy
ID: 2785415
You are welcome
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question