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

Re: Global Vs Root Element.

From: <Noah_Mendelsohn@lotus.com>
Date: Tue, 3 Jul 2001 09:24:46 -0400
To: "Venkateswar Wunnava" <wvsvenkat@worldnet.att.net>
Cc: jeffrafter@definedweb.com, wason@mindspring.com, xmlschema-dev@w3.org
Message-ID: <OFAE69C9A1.471FEC5A-ON85256A7E.004A224B@lotus.com>
Venkateswar Wunnava writes (regarding specification of a root element to 
validate):

>> I do not understand why this piece is being 
>> left so loose in the spec., while all 
>> possible forms of neat mechanisms have 
>> been provided in XMLSchema specification. 
>> Is there any specific reason for doing that,
>> which I am missing?

As summarized in the Schema FAQ [1]:

"As far as the schema language itself is concerned any global element can be 
used as a root element, but it is intended that the application or 
processor could be parameterized to check. For example, consider a 
perfectly reasonable processor that would take a command line like: 
 
 
        validate -instance myinstance.xml -schema myschema.xsd 
-rootElementName purchaseOrder
 
such a processor could provide the added service of checking the name of 
the root element. There are at least two reasons that the schema language 
does not take a more rigid view of roots (a) there are situations in which 
you truly find it useful to have different element names serve as the root 
of a document and (b) even if purchaseOrder is the root of the instance, 
you may decide that you only want to validate the shippingAddress. So, the 
root of the validation need not be the root of the instance document."

In other words, if we had fixed roots, then partial validation would have 
been a special case with added complexity.  Futhermore, since there are 
vocabularies in which multiple roots are useful, we would have needed yet 
more special features to control which one(s) were and were not legal. 
Yes, it's all doable, but we decided on this compromise.  I'm not 100% 
sure it's the best compromise, but there are legitimate reaons for it.

BTW:  while I don't agree with quite everything in the FAQ, many of the 
obvious questions about the schema language are discussed there.  Readers 
of schema dev may want to take a look.

[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 Tuesday, 3 July 2001 09:30:11 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:22 GMT