OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Namespace: what's the correct usage?

Jeff Rafter wrote:

> 1) I think Martin's example is perfectly legal wrt to XML Schemas and XML
> Namespaces.

no is arguing that Martin has broken any laws (except perhaps running afoul
of Okam's razor)

> Moreover, I think (coming from an implementation of XML Schemas
> POV) it actually makes a ton of sense.

really why? it seems to be plain confusing. why use both qualified and
unqualified elements in a structure? why make the structure more

> 2) That being said-- the first time I stumbled onto a sample such as
> Martin's-- I thought, "Whoa-- that is an error..." only an hour later did
> learn it was valid.  Only a month or two later did I understand why it was
> good.  Qualified names are much more easy to understand and program for
> (from experience) whereas unqualified names *are* dependent on context and
> declaration.  Being dependent on declaration means that each instance
> be processed by a schema validator to obtain PSVI wrt namespace uris
> the exception of xmlns='' is presumed a priori).  For example:

the qualification or lack thereof of an element name means absolutely
nothing in and of itself regarding context dependence. at the most basic
level a qualified name is simply a qualified name. an element with a
qualified name is no less nor more an element.

i suppose every instance must be processed by a schema validator to obtain a
true "PSVI" -- otherwise it would simply be an "I".

> <root xmlns="http://foo">
>   <name>
>      <mandatory-title-element/>
>   </name>
>   <p:person xmlns:p='urn:x2' >
>     <name>Martin</name>
>     <age>33</age>
>   </p:person>
> </root>
> Without the use of xmlns='' this get's ugly in a hurry.  There is
> an ambiguity introduced for <name>.  From the instance one can imagine
> <name> is declared in both the http://foo and urn:x2 namespaces.  So which
> namespace is the "Martin" element actually in?  It get's confusing-- it is
> either part of the default namespace (though this is very hard to declare
> actuality)

nothing changes the rules of XML 1.0 and XML namespaces. In your example
_each_ <name> element is qualified by the http://foo namespace. none are

> or it is an unqualified element from the urn:x2 namespace (which
> is the more correct assumption).

there is no such thing as an "unqualified element from the urn:x2
namespace". doesn't exist.

this example, and your analysis of it are proof that this construct is
confusing. it is _genuinely_ confusing. i say "let's keep life as simple as

> 3) I think for the reasons stated above qualified is the "easiest"
> (and therefore best?).  While I concede Martin's point about package
> and Java representation-- it seems simple enough to relent and utilize a
> default namespace in that case (which I have done with some success)
>   <person xmlns='urn:x2' >
>     <name>Martin</name>
>     <age>33</age>
>   </person>

I agree, (aside from the fact that urn:x2 is not a 'legal' URI)
http://example.org is defined by an RFC to be used as an example URI.