OT: static typing and DTDs

Lulu of the Lotus-Eaters mertz at gnosis.cx
Sat May 3 22:02:57 EDT 2003


ulkis_blaffa at hotmail.com (ulkis) wrote previously:
|static typing is as marginally useful and incomplete for error removal,
|as DTD:s are for validating the contents of an XML doc...

I'll come to the defense of DTDs here... I agree on static typing.

DTDs do precisely what they were intended to do, and do it extremely
well.  In their SGML roots, DTDs are about specifying the layout of
DOCUMENTS.  XML, on the other hand, has a split personality, both prose
documents and data-oriented tables/trees.

If you expect a DTD to guarantee for you that cell one and cell two
contain numbers, and cell three contains the average of the two, you'll
be out of luck.  It is in answer to such an abuse of XML as a
make-believe RDBMS that abominations like W3C XML Schemas were invented.
Of course, W3C Schemas only wind up going a tiny step towards solving
the problem they aim at, and cause more problems than solutions (RELAX
NG is much nicer, but is again not really data-oriented).

However, if you want a book, or an article, or some other document, to
contain a specific set of contents, a DTD can specify quite precisely
and concisely what is needed.  Moreover, if you can guarantee an XML
document conforms to a known DTD, it is amazingly simple to write a
conversion/processing application that will deal correctly with EVERY
instance of a valid document.  Mind you, the DTD won't guarantee the
quality of the prose, or the accuracy of the information... but that's
not its goal.  A DTD *will* tell you that something is a genuine
"article" according to the elements you need for a particular forum.

Yours, Lulu...

--
Keeping medicines from the bloodstreams of the sick; food from the bellies
of the hungry; books from the hands of the uneducated; technology from the
underdeveloped; and putting advocates of freedom in prisons.  Intellectual
property is to the 21st century what the slave trade was to the 16th.





More information about the Python-list mailing list