Namespaces A Mess?
Date: Sun, 16 Oct 2005 00:27:11 +0100
From: Michael Kay <email@example.com>
To: 'Doug Schepers' <firstname.lastname@example.org>, email@example.com
Subject: Namespaces A Mess?
Just look at the xsl-list archives and see the proportion of user problems
that are caused by namespaces.
Or, if you were able, look at the minutes of any W3C working group and see
the proportion of its effort that goes into dealing with the complexities
caused by namespaces.
The main issues are:
(a) exactly what strings are permitted as namespace URIs? Different specs
differ on the point.
(b) are namespace declarations information-bearing? For example, are the two
documents below equivalent:
(1) <a xmlns:x="x"><b/></a>
(2) <a xmlns:x="x"><b xmlns:x="x"/></a>
(c) are in-scope namespaces that are not referenced information-bearing? For
example, are either of the above documents equivalent to:
(the main problem here, of course, is "QNames in content": the use of
namespace-sensitive element and attribute values. But there are also
applications that use the mere presence of a namespace declaration as a flag
(d) are prefixes information-bearing? That is, is document (1) equivalent
(4) <a xmlns:y="x"><b/></a>
(again, the problem is "QNames in content")
(e) in the light of the above, how should namespaces be handled by
applications that allow a document to be modified? For example, if an
element is deep-copied from one place to another, should it take all its
in-scope namespace declarations with it?
(f) DTDs are an intrinsic part of XML, but DTDs are not namespace-aware.
(g) How should namespaces be versioned?
At a higher level, namespaces cause immense design difficulty. How should a
large organization creating hundreds of XML document definitions manage its
allocation of namespaces? You could say that any naming scheme would have
this problem. However, the design of XML namespaces is optimized for
situations in which the number of namespaces is small (more than five in a
document gets unwieldy). This makes namespace management very difficult.
There's a basic root cause of many of the difficulties, which is that naming
in any information architecture is absolutely fundamental, yet the naming
architecture of XML has been "patched in" as an afterthought at a layer
above the core. That, plus the fact that the information model itself (the
infoset) is non-prescriptive and layered above the core.
Prepared by Robin Cover for The XML Cover Pages archive. See general references in "Namespaces in XML."