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

Re: Forcing a certain document element

From: <Noah_Mendelsohn@lotus.com>
Date: Fri, 12 Jan 2001 17:46:27 -0500
To: Robert Braddock <stormwarden@bigfoot.com>
Cc: xmlschema-dev@w3.org
Message-ID: <OF09820704.BCC3442A-ON852569D2.007CDBA5@lotus.com>
For what it's worth, I would use global elements when the actual semantic 
import of the element is in some sense primarily independent of the types 
of its ancestors.  One could argue that <HTML:P> tends to have this 
characteristic:  it means "paragraph" in just about any context where it's 
legal.  Conversely, consider:

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

<TITLE> clearly has local scope.  Indeed, the second use might well be 
typed as an enumeration (Mr., Ms. Mrs., etc.)  When mapping programming 
language and database structures, local tends to fit best.  When 
translating a DTD, global is almost always the truer approximation.

In short, I would generally recommend making the choice based on these 
sorts of considerations.  In certain situations, that may indeed lead to a 
single global root, with all other elements local.  In general, I would 
use multiple globals where appropriate, and rely on the processor or 
application to verify that the root of a document is the one intended.

Note one other benefit of using globals:  you can do selective validation 
of global elements.  For example, if <AUTHOR> is global and if your 
processor is willing, you can validate just the author element.  Very 
useful in editing and other situations.    To do the same with a local 
element you would have to determine the correct type to use for the 
validation (see the first option under [1]).  Not impossible, but surely 
trickier.  I doubt that many processors will support this, particularly if 
your local element has an anonymous type.

[1] http://www.w3.org/TR/xmlschema-1/#validation_outcome


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







Robert Braddock <stormwarden@bigfoot.com>
Sent by: xmlschema-dev-request@w3.org
01/12/01 04:18 PM
Please respond to Robert Braddock

 
        To:     xmlschema-dev@w3.org
        cc:     (bcc: Noah Mendelsohn/CAM/Lotus)
        Subject:        Re: Forcing a certain document element


> > without violating this property, I appreciate if people design without
> > global elements (I just use global complexTypes where I had global 
elements
> > before).
> 
> That's quite a constraint, though, especially where multiple namespaces
> are involved since types behave differently than elements in this
> context.

I don't see what you mean here. My schemas just reference types through 
their
schema's namespace, just like global elements would be referenced. I do 
this
specifically for the multiple namespace case. Could you explain?


Robert Braddock
Received on Friday, 12 January 2001 17:52:58 GMT

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