Understanding XML DTDs
To use a markup language defined with XML, you should be able to read and understand the elements and entities found in its XML DTD. But don’t be put off: while XML DTDs are verbose, filled with obscure punctuation, and designed primarily for computer consumption, they are actually easy to understand once you get past all the syntactic sugar. Remember, your brain is better at languages than any computer.
As we said previously, an XML DTD is a collection of XML entity and element
declarations and comments. Entities are name/value pairs that make the DTD easier to
read and understand, and elements are the actual markup tags defined by the DTD, such as
<h1> tags. The DTD also describes the
content and grammar for each tag in the language. Along with the element
declarations, you’ll also find attribute declarations that define the
attributes authors may use with the tags defined by the element
There is no required order, although the careful DTD author arranges declarations in such a way that humans can easily find and understand them, computers notwithstanding. The beloved DTD author includes lots of comments, too, that explain the declarations and how they can be used to create a document. Throughout this chapter, we use examples taken from the XHTML 1.0 DTD, which you can find in its entirety at the W3C web site. Although it is lengthy, you’ll find this DTD to be well written, complete, and, with a little practice, easy to understand. ...
Get HTML & XHTML: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.