[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Suggested guidelines for using local types. (was Re: Enlightenmentvia avoiding the T-word)
- From: Jonathan Borden <jborden@mediaone.net>
- To: "Fuchs, Matthew" <matthew.fuchs@commerceone.com>, xml-dev@lists.xml.org
- Date: Wed, 05 Sep 2001 14:10:31 -0400
Matthew,
>
> I think you mentioned at one point that you were on vacation during the
> start of this rather long and verbose thread. The discussion is entirely
> about the treatment of local elements as defined by XML Schema.
I assume that the discussion regards the implications for XML Schema's
"local elements" for _XML_ because if we aren't talking about XML, then this
is simply the wrong forum.
> If you read
> the XSDL spec, you'll see it defines "local" and "global" elements by the
> context in which those elements are declared in a Schema - either at the
> root level or within a type - not where they appear in an instance. In
> particular, the same local name may be used for an element scoped locally
to
> a variety of different types, so in the context of XSDL, the same local
name
> may refer to a variety of different elements - meaning different structure
> and different semantics (there's enough contention on the difference
between
> "same element" and "different element" to keep modal logicians busy for a
> decade at least).
Of course one define identical syntaxes with DTDs which don't need to invoke
such "local" and "global" differentiations. I wonder what the real need for
this complexity is?
You see this really does have implications for XML because the instance
documents which are produced intending to be valid with respect to some
schema have element names which are defined by the schema. Indeed your
suggestion that one might differentiate an XML Schema "local element" from
an XML Schema "global element" based on whether such an element is either
namespace qualified or not smacks of a sneak attack on XML itself.
Particularly the practices which you argue for go against what I consider
XML namespace best practice, so again, this discussion is hardly limited to
XSDL "local types".
> I hate to sound like a professor ("You haven't done your reading!"), but
you
> might want to come up to speed on that aspect of this and then see if what
> I've written makes more sense.
I didn't buy the argument the first time around. Are you suggesting that
your position is so self evident that the only rational reason for
disagreement is a lack of understanding?
My basic position is this: It is a best practice to design document schemas
so that the structure of the resulting documents is evident from inspection
of the documents themselves without requiring reference of the schema
itself. (as much as is reasonably possible). For example HTML processors are
perfectly capable of processing HTML documents -- without reading the HTML
DTD each and every time the document is parsed --. Schemas can be incredibly
useful, particularly during the software development phase i.e. assisting
with the automatic generation of user interfaces, storage and indexing of
documents in databases, debugging, etc. but still, it is a best practice not
to needlessly rely on a scheme at every step in a production system. Of
course this is my viewpoint and YMMV.
Back to XSDL, the entire point of using schemas is to design XML document
structures. XSDL "local types" have no reason to exist otherwise. Certainly
this discussion is about more than XSDL in isolation.
> >
> > Shrug. I've never had to resort to namespaces to sort out
> > similar issues in
> > programs. e.g. C++.
> >
>
> Because "real" programming languages have the treatment of namespaces
> integrated into the language in a smooth way. XSDL does not.
XML and XSDL are not, nor are they intended to be, "programming languages".
Perhaps this is the big disconnect. Let's not design our XML/XSDL best
practices toward the view of XML as a programming language!
> > >
> > > The global "name" now matches against the right template.
> > The "person"
> > > template matches against the right template. And the _local_ "name"
> > doesn't
> > > match the template for the global "name" because (tada!)
> > it's not in the
> > > right namespace. Therefore it defaults to matching the
> > default template -
> > > just the behavior Rick wants (I think).
> >
> > Again, if the template does not blindly call
> > <apply-templates> this isn't an
> > issue.
> >
>
> But why shouldn't the template blindly call <apply-templates>? Certainly
> it's better to let people worry about their problem, not XSDL's problems.
>
People shouldn't blindly call apply-templates specifically to avoid the
problem you note above. If you want to invent "local elements" in order to
allow you to program XSLT in your own way, fine, but please try not to foist
this upon all of XML + Namespaces + Schema
Jonathan