Re: Role of a DTD in XML

At 06:26 PM 9/11/96 -0500, Robin Cover wrote:

>I'm having difficulty understanding the precise meaning and rationale
>for the principle articulated as list item #4 in "Draft DD-1996-0001 -
>       In particular, it shall be straightforwardly possible to
>       construct useful XML applications which do not read,
>       or need to read, the DTD of the XML document.
>Question #1: Is "useful" the operative term here?  Or is the meaning
>"useful *browser* (XML) applications"? 

As part-author of this, I should offer some exegesis.  Obviously,
without some Markup Declaration, you can't validate against a grammar, or 
really do any meaningful "validation" aside from ensuring tags aren't mangled 
and are properly nested and so on.

On the other hand, ensuring that tags aren't mangled, and constructing the
de facto parse tree, are often useful things to do.  You mention browsing 
applications, correctly; but search/retrieval is another case.  Note that for 
both, you probably need some more information (stylesheets for browsing, some 
metadata about the elements for searching), but not of a type that's found in 
a DTD.

However, with SGML, you just can't do this basic stuff without a DTD.  And
in particular you can't do it for a document *fragment* even if you have
a DTD, unless you ship around some ancillary info like the SGML/Open 
fragment wrappers, and you have a parser that can interpret them and
leap into the middle of a complex parse state.

One of the motivations for XML is the desire to solve exactly this problem;
the goal being that any XML doc or fragment, by itself, can be "parsed" in
the sense of building an unambiguous tree.

I think this addresses your question #2 as well: the desire is not to do
things that need a grammar without a grammar; just to do things that shouldn't
need a complete DTD without a complete DTD.  A lot of applications
will continue to require Markup Declaration. 

Which is one of the areas where XML is going to get really interesting.  XML
needs Markup Declaration, but:

 o Does it need *complete* markup declaration in every case?  Partial markup 
   declaration (these elements are empty, these attributes are #FIXED, etc.) 
   could be very useful (and provides my favorite solution to the EMPTY
   element conundrum, what Michael calls "Cooked Bits".)
 o Should we use 8879 Markup Declaration (aka SGML Declaration & DTD) syntax
   for XML Markup Declaration?

Cheers, Tim Bray
tbray@textuality.com http://www.textuality.com/ +1-604-488-1167