[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Namespace: what's the correct usage?

  • From: Jonathan Borden <jborden@m...>
  • To: Jeff Rafter <jeffrafter@e...>, xml-dev@l...
  • Date: Mon, 21 May 2001 19:12:19 -0400

okam s razor
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
complicated?

> 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:

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
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)

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
prefixed.

> 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
possible"

>
> 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>

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.

-Jonathan



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.