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?



Well, go to one large computer gaming conference and look what happens... I
apologize for being wildly out of the loop but I have read the thread and
think I have some important viewpoints to add.  I will try to be brief-- ask
for clarification if needed.

1) I think Martin's example is perfectly legal wrt to XML Schemas and XML
Namespaces.  Moreover, I think (coming from an implementation of XML Schemas
POV) it actually makes a ton of sense.  I think a lot of the initial
confusion in the beginning of the thread was centered around the three terms
"unprefixed", "unqualified" and "no-namespace".  These are different, and as
Martin has asserted, unqualified namespaces are determined by context and
declaration-- I take the prefix as syntactic sugar.

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 I
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 *must*
be processed by a schema validator to obtain PSVI wrt namespace uris (unless
the exception of xmlns='' is presumed a priori).  For example:

<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 definitely
an ambiguity introduced for <name>.  From the instance one can imagine that
<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 in
actuality) or it is an unqualified element from the urn:x2 namespace (which
is the more correct assumption).

3) I think for the reasons stated above qualified is the "easiest" practice
(and therefore best?).  While I concede Martin's point about package details
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>

Regards,
Jeff Rafter
Defined Systems
http://www.defined.net
XML Development and Developer Web Hosting