XML Namespaces

By Sean McGrath, ITworld |  How-to

Chaos Theory tells us that the mere flapping of a butterfly's wings in
a South American rain forest can cause hurricanes on the other side of
the world. Believing this makes it hard not to be awestruck. After all,
a butterfly is a small and beautiful creature. How could something so
harmless looking be the root cause of significant and detrimental
events on a global scale?

The XML world has its own chaos theory-enabled butterfly known as
the "Namespaces in XML" W3C Recommendation from 1999. Weighing in at a
mere 15 pages, the namespaces Rec is certainly small, though opinions
differ on its beauty. Aesthetics aside, its ability to wreak havoc on a
global scale in the XML world is beyond doubt.

Ostensibly, the namespace Rec is just a simple way of allowing element
type names to be globally unique. Unfortunately, in so doing, it
introduces rules for defaulting namespaces that significantly
complicates any software it touches. XPath, SAX, DOM, XQuery, XSchema,
and XSLT -- all of these are caught up in the flapping of the namespace
Rec's wings, and it is not a pretty sight! I won't go into the details
here, but type any of the previous words into a search engine along
with "namespace" and "problem" and you will see what I mean.

Recently, the W3C introduced a draft of version 1.1 of the namespace
Rec. The changes suggested are minor but have caused the namespace
debate to erupt again on xml-dev (http://lists.xml.org/archives/xml-
dev/200204/threads.html). Joe English, who is one of the most
knowledgeable people about markup technology on the planet, was moved
to post a plea for sanity that is well worth reading
(http://lists.xml.org/archives/xml-dev/200204/msg00170.html).

When someone as knowledgeable as Joe English starts classifying
compliant namespace usage patterns into categories
called "neurotic", "borderline", and "psychotic", it behooves us to
take a step back and look at what is going on here! When the XML world
revisits its fundamentals (around 2008 I suspect as these things always
take a decade), namespaces will need to have their wings well and truly
clipped in order to redress some of the chaos and damage caused from a
decade of inconsiderate flapping.

My advice: Don't use namespaces at all if you can avoid it. If you
can't, then only put them on the root element. Oh, and don't lend money
to anyone who tries to tell you namespaces are simple.

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Answers - Powered by ITworld

ITworld Answers helps you solve problems and share expertise. Ask a question or take a crack at answering the new questions below.

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Ask a Question