[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Namespace: what's the correct usage?
- From: Jeff Rafter <jeffrafter@earthlink.net>
- To: Kohsuke KAWAGUCHI <kohsukekawaguchi@yahoo.com>
- Date: Mon, 21 May 2001 22:10:24 -0700
Let me be the first to agree that your examples correctly reflect the XML
Namespace view of namespace qualification as well as the XML Schema view.
My point wasn't the interpretation of namespace which *should* be standard--
my point was location of declaration and validation concerns:
> > Without the xmlns='' a validator wouldn't know where to look for the
> > declaration of name
Clearly the namespace qualification is as you say-- but where are these
mystical elements declared?
<{}foo>
<{ns1}bar>
<{}child/>
</{ns1}bar>
</{}foo>
<{}child> _may_ be declared in the XML Schema describing this no-namespace
instance root-- or it _may_ be declared as an unqualified element within the
XML Schema describing the targetNamespace ns1. Although it may be declared
in either location I believe the latter to be *far* more common. To declare
it otherwise (with control vs. allowing any/other) you would have to have
schema1 with no target namespace containing a declaration for foo which
allows bar from ns1. Then, schema2 which has a target namespace ns1 and
declares the bar element must allow as it's content elements with the ##any
namespace (or if foo had been qualified, ##other with the namespace
specified). This is rarely done. It is much more common for the bar
declaration to allow the unqualified element child which it defines. Within
this model-- the validator is much more likely to avoid ambiguity by
choosing the local (at that point) declaration.
In the case:
<{ns1}foo>
<{ns2}bar>
<{ns1}child /> <!-- not ns2-->
</{ns2}bar>
</{ns1}foo>
Again you are right, which is why Martin (and others) override the default
with xmlns=''. This makes the only logical choice in the situation of
unqualified elements obvious. Otherwise it is very ambiguous--which was my
argument. In either case, I think it would make sense for a validator to
proceed in validation treating child as a member of the schema2 schema (not
namespace) if it is declared. This is in complete opposition to the intent
of the Namespace spec. Note: we are arguing the same thing-- this is
confusing. That is why I sided with you wrt to the 'best' practice-- It is
just that I am still maintaining both are very viable.
Regards,
Jeff Rafter
Defined Systems
http://www.defined.net
XML Development and Developer Web Hosting