[
Lists Home |
Date Index |
Thread Index
]
At 10:52 AM +0200 6/6/04, Henrik Martensson wrote:
>Using the XHTML 1.0 doctype declaration constitutes a promise to stick
>to XHTML, and not to mix in elements and attributes from namespaces
>that have not been declared in the XHTML DTD.
Absolutely not! All using the XHTML DTD promises is that the DTD can
be found at a certain URL, and used to apply some default attributes
values and resolve some entity references. It in no way promises that
the document is valid.
This is one of two qualitative differences between SGML and XML. In
XML validity is optional. It is *not* required. Adding a document
type declaration makes no promises that the document is valid. It
simply says you might find this DTD to be useful when processing the
document.
Many developers believe that rigid, conservative (everything not
permitted is forbidden) schemas are necessary to produce software.
Nothing could be further from the truth. Programming with the
expectation that the schema will be followed leads to brittle,
inextensible, closed systems that break at the first whiff of change.
Robust, flexible software that can handle extensions gracefully
begins with the realization that any fixed schema is inadequate for
some uses, and that one must be prepared to handle both schemaless
and invalid documents.
Again, the question one should ask when presented with an XML
document is, "Can I extract the information needed to perform my task
from this document?" The question should not be, "Does this document
adhere to one very precise and constrained format in the universe of
all possible formats?"
Sometimes the answer, is "I don't know" and the document may need to
be kicked to a human for further analysis. In practice, however, most
systems encounter a fairly limited number of document formats (though
that limited number is normally greater than 1) and these can all be
recognized and handled, with occasional fallbacks to people to add
support for newly recognized formats.
--
Elliotte Rusty Harold
elharo@metalab.unc.edu
Effective XML (Addison-Wesley, 2003)
http://www.cafeconleche.org/books/effectivexml
http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA
|