Sp 344

From Htmlpedia
Jump to: navigation, search

Contents

OpenSP: No document type declaration; implying ...

Cause:

The checked page did not contain a document type (DOCTYPE Declaration). The validator has tried to validate with a fallback DTD, but this is quite likely to be incorrect and will generate a large number of incorrect error messages. It is highly recommended that you insert the proper DOCTYPE declaration in your document -- instructions for doing this are given above -- and it is necessary to have this declaration before the page can be declared to be valid.

Example:

Bad
<html>
<head>
<title>document without DOCTYPE</title>
</head> ...
Good
<!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>XHTML-document</title>
</head> ...
Good
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>XHTML-document</title>
</head> ...
Good
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
   "http://www.w3.org/TR/html4/strict.dtd">
<title>HTML4-document</title>
<p>Some content
Good
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
  "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<title>HTML-document</title>
</head> ...


Good
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html lang="en">
<head>
<title>XHTML11-document</title>
</head> ...

For complete compliance, a XHTML1.1 document must not be sent as text/html, but as application/xhtml+xml or text/xml as Internet Explorer does not understand the application/xhtml+xml content type and invites the user to save the document instead of rendering it in the browser.

Solution:

Please insert a DOCTYPE declaration as the very first thing in an HTML document.

References:

Personal tools