Re: Global Vs Root Element.

A few thoughts on the global/root question: 

First of all, there is a brief treatment, adapted from a note I sent 
months ago, in the schema FAQ [1]. 

There are really at least two questions here:  designating roots, and 
globals vs. locals.  The second question is relatively easy: globals are 
the sorts of declarations you have in DTDs.  If you do the obvious 
conversion of a DTD to a schema, then every element is global.  Period. 
Locally scoped elements allow you to model cases like:

        <BOOK>
                <TITLE>Moby Dick</TITLE>
                <AUTHOR>
                        <TITLE>Mr.</TITLE>
                        <LASTNAME>Melville</LASTNAME>
                </AUTHOR>
        <BOOK>

Clearly the book title and the author title are different beasts;  the 
latter probably is an enumeration of Mr./Ms., etc.  Locals let you express 
this;  DTD's (globals) do not.  Don't try to read more into globals/locals 
then that.

The FAQ covers the root question, as does Tom, but I'll reiterate a bit. 
Not only are there times when you want to allow multiple root names from a 
given namespace (maybe it's OK to root at either BOOK or BOOKLIST), what's 
more important is that you might want to do partial validations.  Maybe 
you only want to validate an <AUTHOR> or a <SHIPPINGADDRESS>.  This is a 
very common case for editors.  If we had explicit roots, then things would 
be more complicated.  I'd need two validation modes:  whole documents and 
fragment.  As it stands, there's just one:  you can validate from any 
element, top level or not, using any matching element declaration or 
complex type.  So, leaving out root as a distinguished concept let us 
cover more cases with a single mechanism. 

[1] http://redrice.com/schemavalid/faq/xml-schema.html#d6

------------------------------------------------------------------------
Noah Mendelsohn                                    Voice: 1-617-693-4036
Lotus Development Corp.                            Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
------------------------------------------------------------------------

Received on Friday, 15 June 2001 13:09:14 UTC