Mapping DTDs: making validation usable
21 May 2004
» DTD Mapper «
One of the qualms people have with validating pages is that they never know what they're validating from. The W3C releases documents called Document Type Definitions (DTDs) that strictly specify the grammar and form that HTML/XHTML documents must take in order to validate as HTML 4.01, XHTML 1.0, or XHTML 1.1. In the not too distant future, web sites will be able to supply their own DTDs, letting them create valid XML documents with a custom syntax all their own. (IBM already uses one)
However, while DTDs are perfect for letting a computer know whether a document is valid, just try reading one with your own human eyes. I'd give you cheque for $50.00 if you could look at the XHTML 1.0 Strict DTD and tell me in five minutes what elements are allowed to be nested inside a cite tag. (Cheques will not be honoured)
As Andrei pointed out, the W3C don't help matters with their deeply hidden documentation and under-described recommendations. So, I've written a program that takes the leg work out of it for you. Using the DTD Mapper all you have to do is paste in the URL of the DTD that your pages are meant to be validating to (that URL in the weird DOCTYPE line at the top of your source code), and you'll get a nice, collapsible list of all valid elements, with their attributes, possible child elements and possible parent elements.
Of course, automated tools like this won't be able to tell you everything about the specifications for a document – there's a large gap that can only be filled by human description – but it should be handy for some of your queries. Any suggestions for improvements, just post them here!
Tested in IE6, Firefox 0.8 (Win). Thanks to Earl Hood for the perlSGML parsing modules.
Follow me on Twitter
To hear smaller but more regular stuff from me, follow @themaninblue.
- Resolution dependent layout update
- footerStickAlt: A more robust method of positioning a footer
- widgEditor: A simple, standards-compliant WYSIWYG HTML editor
- Accessible, stylish form layout