A DTD is a generic document which describes the content of another document (here a HTML or XHTML document). In other words, it defines the elements and attributes which make up the markup that a browser will interpret to display and layout the document, and how they interact.
What is validation? Validation is a process through which the conformity of a document is checked against its description (DTD). Reasons to validate a document include:
Some organizations provide tools for validating different types of documents, such as HTML, XHTML, style sheets (CSS) or other documents. Two organizations are standing out of the crowd because of their importance or quality of service regarding validation.
The first is the World Wide Web Consortium (W3C), official keeper of standards (Recommendations) used on the Internet. All validation services are referring to these standards. The W3C provides different online validation tools in relation to their different published standards. We are interested in the following tool:
The second is the Web Design Group (WDG) which validator, in addition to services similar to those of W3C validator, allows validation of documents with a custom DTD. This is the tool:
Some browsers are still using proprietary tags or attributes, and we sometimes have to use non-standard elements or attributes for compatibility reasons. Here are two examples:
embedelement to be included in a
objectelement in order to play a QuickTime™ or Flash™ movie
framesetelement, which are sometimes required to suppress a spacing between frames of a frameset.
Too many pages are failing validation tests essentially because validators can only check them against the standard DTDs. Systematically, they stumble on pages containing elements or attributes which are not part of these standard DTDs. Validation results can also be intimidating or discouraging to authors. To ease code correction and promote better coding practices, one must be pragmatic sometimes.
loose.dtdstandard document to include the
frameset.dtdstandard document to include attributes for the
And similarly in XHTML 1.0:
xhtml1-transitional.dtdstandard document to include the
xhtml1-frameset.dtdstandard document to include attributes for the
A DTD is associated to a documents through a document type declaration
DOCTYPE at the beginning
of HTML or XHTML documents.
For example, the following HTML document has a standard DTD:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Let say that this document is hosted on example.net ; a custom DTD will be associated like this:
<!DOCTYPE HTML SYSTEM "http://example.net/loose_custom.dtd">
We substitute the
PUBLIC identifier from the standard definition with a
then we specify the location (URL) of the modified DTD
in the website.
(Same principle for a XHTML document except that we'll have to write
html in lowercase
as XHTML is case sensitive.)
Then there are two cases:
DOCTYPEdeclaration is sufficient.
A rarity in the world of validators, the WDG Validator is able to process HTML or XHTML documents with a custom DTD.
Two examples of validation with custom DTD are provided: one with HTML documents and one with XHTML documents. Different custom DTDs are used simultaneously, and both examples are sharing the same template: a frameset defining an upper frame for navigation and a lower frame for main display.
<frameset rows="40%,*" border="0" frameborder="0" framespacing="0"> <frame name="navigation" src="navigation.php" title="Navigation frame" marginheight="0" marginwidth="0" frameborder="0"> <frame name="principal" src="principal.php" title="Main display frame" marginheight="0" marginwidth="0" frameborder="0"> </frameset>
The frameset definition page is associated to a custom DTD (non-standard attributes appear bolder in above code) ; the navigation frame references a document named navigation.php associated to a W3C standard DTD ; the principal frame references a document named principal.php which includes a QuickTime animation and which is associated to a custom DTD.
Custom DTDs given as examples are available in the following compression formats. Once decompressed, open files with a text editor and follow instructions inside for adaptating these DTDs to your needs:
object. See also a more exhaustive article on this subject published on Devedge.
Additionally, following the Eolas patent case in 2003, named from the patent holding company, all editors worried at the idea of commiting any patent infringement recommand to use dynamic solutions based on scripts. For example, see instructions provided by Apple®, Adobe® and Real Networks® for embedding, respectively, QuickTime™, Flash™ and RealVideo™ movies ↑