W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2001

Re: Global Vs Root Element.

From: <Noah_Mendelsohn@lotus.com>
Date: Fri, 15 Jun 2001 13:04:26 -0400
To: "Venkateswar Wunnava" <wvsvenkat@worldnet.att.net>
Cc: jeffrafter@definedweb.com, wason@mindspring.com, xmlschema-dev@w3.org
Message-ID: <OFE6E9ACCC.0F78037A-ON85256A6C.005D4EAB@lotus.com>
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:

                <TITLE>Moby Dick</TITLE>

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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:52 UTC