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

Re: To namespace or not to Namespace ....

  • From: Liam R E Quin <liam@w3.org>
  • To: Andrew Welch <andrew.j.welch@gmail.com>
  • Date: Wed, 07 Apr 2010 13:28:32 -0400

Re:  To namespace or not to Namespace ....
On Wed, 2010-04-07 at 16:13 +0100, Andrew Welch wrote:

> Unprefixed namespaced xml can be a pain, but prefixed xml is no problem at all.

I think this very much depends on the environment. Every week I get
asked, for example, how to match namespaced nodes in XPath 1.0 from PHP;
the best answer there usually turns out to be things like
    /*[name() = 'document']/*[name() = 'chapter']/*[name() = 'title']
(the xPath implementation most widely used with php doesn't seem to have
a local-name() function).

Pretty much every day I encounter people banging their heads against a
wall (or a sturdy person) asking why their XPath xpressions don't match;
I also occasionally hear from people who abandonded XML processing and
moved to using JSON or some other technology, or who abandoned XPath
or XSLT or XQuery, and went back to using Java and the DOM API, because
they couldn't figure it out.

So while I hear your concern about possible ambiguities down the line,
I still think that for most people using XML, and in most situations,
it's better to avoid namespaces. Frankly, you're better off following
Tim and Micah's suggestion (which became part of Micah's "pragmatic
namespaces" proposal) and using element names like
    welch.j.andrew.chapter rather
than namespace prefixes.

All this is not to say that namespaces have no use. But they are used
much more often than they are needed, they are wanted less often still,
and they are ineffective at solving many of the problems people often
expect them to solve.

If you put prefixes on all your elements in case someone wants them,
the chances are every bit as high that someone else will need to take
them all off again. There's no single future-proof answer for all

Within a specific environment, one can make stronger statements.



Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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.
First Name
Last Name
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.