Re: XML Validity and DTD dependance

Rich Salz scripsit:

> How about this?
>         I give you a document with[out] a DTD and say "it's valid XML."
> 
> Why can't I do that?  Why do I have to give you a DTD?

XML validity is fundamentally different from validation against a W3C
XML Schema or RELAX NG or Schematron schema.  The purpose of schema
validation of whatever flavor is to answer the question "Is the XML
document consistent with the rules laid down in the schema document?"

By contrast, XML validation answers the question "Is the XML document
self-consistent?"  Or to put it another way, "Do the elements and
attributes in the document agree with the declarations in the same
document?"

A document "without a DTD" (that is, with neither an internal nor an
external subset) doesn't contain any declarations, so it can't possibly
be self-consistent in the relevant sense.

(Note that I speak of XML documents, not XML entities; XML validation is
determined for the entire document with all its entities, including the
document entity, a possible external subset entity, possible external
parameter entities, and possible external general entities.)

-- 
There is / One art                      John Cowan <jcowan@reutershealth.com>
No more / No less                       http://www.reutershealth.com
To do / All things                      http://www.ccil.org/~cowan
With art- / Lessness                     -- Piet Hein

Received on Friday, 22 April 2005 13:19:51 UTC