[plug] XML DTD

Colin Muller colin at twobluedots.com.au
Mon Nov 25 13:09:11 WST 2002


> DTDs are more eye-ugly and less expressive than the XML for visual
> inspection, so again
> it begs the question. WHY?

You'll find a lot of people, like you, are not using them because they
know they can depend on what their software is generating. It's in
recognition of this that the people who created XML introduced the
idea of well-formedness vs validity. Well-formed means it can be
parsed by a conformant parser (i.e. it conforms to XML's grammar),
which is, for you, all you have felt the need of.  Valid means it
conforms to a DTD. Now there are other schema languages for other
kinds of validity (e.g. data types).

The notion of validity can be useful (more than a little, actually) if
you are hand-editing something, e.g. a Linux HOWTO.

Even if you are not, it gives someone other than you a guarantee that
if they apply a certain type of processing to what you have sent them,
it'll work. A simple real-world example is that Mozilla will render a
DTD-conformant (X)HTML document more easily, and much quicker, than
one which is not valid; in the latter case, it activates "Quirks
mode", which means it scratches its head to try to work out what type
of document the data it has received is trying to be. You can check
which mode it is using for any page by looking at the Page Info (mouse
button 2, View Page Info).

Things like DTD conformance can also be most valuable in contract
specifications: you guarantee your client that you will deliver valid
DocBook XML documentation, and they have a way of checking whether you
are sticking to your promise, no matter if what you give them is
machine or hand-generated.

Colin



More information about the plug mailing list