Forum Moderators: open

Message Too Old, No Replies

Fatal error No DOCTYPE please help!

         

derekwit

5:06 pm on Dec 30, 2002 (gmt 0)

10+ Year Member



I have searched with no prevail about DOCTYPE. I just went a tried to validate my HTML code and received this error. Any suggestions on how to fix.
Fatal Error: No DOCTYPE specified!
I could not parse this document, because it does not include a DOCTYPE Declaration. A DOCTYPE Declaration is mandatory for most current markup languages and without such a declaration it is impossible to validate this document.

You should place a DOCTYPE declaration as the very first thing in your HTML document. For example, for a typical XHTML 1.0 document:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Title</title>
</head>

<body>
<!-- ... body of document ... -->
</body>
</html>

lorax

5:16 pm on Dec 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Well, it's a pretty self-explanatory error message. :) In order to be a valid document, your HTML file needs to have a DOCTYPE declaration.

Do a search here on WebmasterWorld or at W3C for DOCTYPE and you'll get the info you need to determine which DOCTYPE you'll need to use.

derekwit

5:23 pm on Dec 30, 2002 (gmt 0)

10+ Year Member



That is what is confusing I have a DOCTYPE.

creative craig

5:24 pm on Dec 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What DOCTYPE is it and is it well formed (validly written).

Post the code, so we can see, please?

Craig

lorax

5:26 pm on Dec 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



In that case, look for the obvious typo errors. Post it here if you'd like and let us take a looksy. We don't need the whole page, just the DT declaration.

derekwit

5:28 pm on Dec 30, 2002 (gmt 0)

10+ Year Member



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

dingman

5:33 pm on Dec 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This should help:

[w3.org...]

I've actually had the experience of comparing the DTD in my document character for character with the ones on this page, finding an exact match, and still not having it work. However, if I copy and paste from the w3c page into my document and delete the old (seemingly identical) DTD, things work. My best guess is that there was a character set issue. I haven't checked with a hex editor. Next time, I think I will.

lorax

5:43 pm on Dec 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Your DOCTYPE looks fine. I noticed while I was testing your code that the Validator was choking on my <head> tags telling me I didn't have a closing tag - when in fact I do. Could be just a issue with the Validator. Have you tried the Validator on SEW?

Whoops - forgot to add a <title> tag. Now it works - both mine and yours.

[edited by: lorax at 5:49 pm (utc) on Dec. 30, 2002]

derekwit

5:46 pm on Dec 30, 2002 (gmt 0)

10+ Year Member



I tried to just copy and paste but with the same results. I did however try to change to XML Doctype.

Fatal Error: No DOCTYPE specified!
I could not parse this document, because it does not include a DOCTYPE Declaration. A DOCTYPE Declaration is mandatory for most current markup languages and without such a declaration it is impossible to validate this document.

You should place a DOCTYPE declaration as the very first thing in your HTML document. For example, for a typical XHTML 1.0 document:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Title</title>
</head>

<body>
<!-- ... body of document ... -->
</body>
</html>

lorax

5:51 pm on Dec 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



derekwit,
You do have a head tag and a title right? And there's nothing before the DOCTYPE declaration right (it is the very first line of code without any spaces or other code)?

derekwit

5:56 pm on Dec 30, 2002 (gmt 0)

10+ Year Member



Here are the first few lines of code: Dreamweaver inserts the connections at the top.

<!-- FileName="Connection_cf_dsn.htm" "" -->
<!-- Type="ADO" -->
<!-- Catalog="" -->
<!-- Schema="" -->
<!-- HTTP="false" -->

<html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<title>New and Used Packaging Equipment-MAVPAC Equipment</title>

lorax

5:58 pm on Dec 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Ah... those are just comments. Delete them out and make sure the DOCTYPE starts as the first line.

AND move your DOCTYPE outside of your <html> tag!

[edited by: lorax at 5:59 pm (utc) on Dec. 30, 2002]

derekwit

5:59 pm on Dec 30, 2002 (gmt 0)

10+ Year Member



I don't think I can. I think they tell Dreamweaver what the connections for that page are.

lorax

6:01 pm on Dec 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



See the edited version of my last post.

In rethinking those comments, they shouldn't affect it because they are just comments BUT the DOCTYPE should be outside of the HTML tag.

And you're missing the <head> tag.

derekwit

6:10 pm on Dec 30, 2002 (gmt 0)

10+ Year Member



You are right I just added my <head> tag back in and put the DTD above the <html>. I am going to go see if I can validdate it now.

derekwit

6:19 pm on Dec 30, 2002 (gmt 0)

10+ Year Member



I do not know what it worse? Now I get a whole page of errors: This page is not Valid XHTML 1.0 Transitional!
Below are the results of attempting to parse this document with an SGML parser.

Any suggestions what one of the two is worse?

lorax

6:23 pm on Dec 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Change your DTD back to HTML not XHTML (unless of course you're trying to build an XHTML document!)

dingman

6:25 pm on Dec 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Umm, it certainly wasn't valid before. The difference is that now you've fixed an error so bad that the validator couldn't continue to check the rest of the page. That means you are better off now than you were before.

The next step is to correct the remaining errors. Again, start with the first one on the page, because some of the ones further down the page might in fact just be side-effects of the first one.

<added>And of course, if you wrote valid HTML it is entirely possible that using an HTML DTD instead of one for XHTML would be enough. If so, Lorax's solution would work just fine.<added>

lorax

6:36 pm on Dec 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



That means you are better off now than you were before.

Agreed! The whole point of validation is to ensure you're code is compliant with the guidelines as set forth by W3C. The Validator is simply telling you what it found that doesn't comply.

Don't get discouraged. Often times you'll find that fixing one thing will remove 2 or 3 errors from the validator. Work through them one at a time and check the page after each change.

derekwit

6:42 pm on Dec 30, 2002 (gmt 0)

10+ Year Member



I changed back to html and only receive (1) error. But not exactly sure why I am getting this one?

This page is not Valid HTML 4.01 Transitional!
Below are the results of attempting to parse this document with an SGML parser.

Line 26, column 50: required attribute "TYPE" not specified (explain...).
<script language="JavaScript1.2" src="/mm_menu.js"></script>

lorax

6:59 pm on Dec 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You might want to do a bit of reading at:

[w3.org...]

The short answer is you need to add the type attribute to the <script> element: type="text/javascript"

derekwit

7:29 pm on Dec 30, 2002 (gmt 0)

10+ Year Member



I would like to thank everybody here for their help! I finally validated it......

g1smd

10:41 pm on Dec 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



... and now onwards to do all of the other pages on your site!