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


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] 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]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS