Day Five: More About DTDs
XHTML expert Molly Holzschlag discusses the available DTDs for XHTML.
In Day 4 of this miniseries on XHTML 1.0, I introduced the DTD, or Document Type Definition. A DTD is a document that contains listings for all the elements, attributes, values, and special characters—and how they are written—that are to be allowed in a given document.
XHTML 1.0 has only three DTDs available to authors, who must use one of them—and use it accurately—for the document to be considered valid XHTML 1.0. These three DTDs carry over from HTML 4.0:
- XHTML 1.0 strict—This DTD is the most rigid of XHTML 1.0 DTDs. It contains only those elements and attributes that are current. So, while the p element, with opening and closing tags <p> . . . </p> is part of the strict XHTML 1.0 DTD, the font element, which has been deprecated (set aside for other, more current markup) since HTML 4.0 in favor of style sheets is not part of the strict XHTML 1.0 DTD. The strict DTD is declared in the DOCTYPE as follows:
<!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">
As mentioned in Day 4's article, the DOCTYPE declaration appears at the top of the document.
It's important to mention that in XML, DTDs are part of what makes an application truly extensible. So, while XHTML 1.0 only has three DTDs, in future versions of XHTML—as is currently the case with XML—you will be able to write your own custom DTDs, or use other DTDs available from a wide range of sources. Let's say that you work in the medical field and have common terminology necessary to define information that you'd place in a document. If a DTD has been written by someone that defines elements that you require, you can use that DTD. Or, you can write your own DTD, creating a unique set of elements, attributes, values, characters and rules that customize your documents effectively.
About the Author
An author, instructor, and designer, Molly E. Holzschlag brings her irrepressible enthusiasm to books, classrooms, and Web sites. Honored as one of the Top 25 Most Influential Women on the Web, Molly has worked in the online world for an almost unprecedented decade. She has written and contributed to more than 10 books about the Internet and, in particular, the Web.
Molly holds a B.A. in communications and writing and an M.A. in media studies from the New School for Social Research. You can visit her Web site at http://www.molly.com/.
Molly's most recent publications are Special Edition Using XHTML(Que, November 2000), Sams Teach Yourself Adobe LiveMotion in 24 Hours (Sams, June 2000), and Special Edition Using HTML 4.0, Sixth Edition (Que, December 1999).