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 environments. Within a specific environment, one can make stronger statements. Best, Liam -- 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]
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format