Lists Home |
Date Index |
> Seriously, a) what specific ways do namespaces bite people who
> understand them and use software that supports them properly? b)
> What should one do to avoid being bitten, given that they are
> pervasive? c) How would one do it differently in 20:20 hindsight?
On (c) I suspect many people would say "drop namespaces altogether".
But namespaces are very useful in the languages that I work with (e.g.
XSLT), so while designing LMNL  instead of just getting rid of them
we tried to rethink them so that they would be less problematic. We
decided to make the following changes to the way XML handles
1. Keep namespace declarations for markup (element/attribute names)
and namespace declarations for content (element/attribute values)
separate. Attributes are fine for the latter, but the former
should really be done through something at the syntax level --
ideally dedicated namespace declarations.
The fact that the two levels of namespaces are merged in XML
means that it's impossible to tell which namespace prefixes can
be changed and which can't, which makes canonicalisation and
comparisons between XML documents very difficult. It also
increases the burden on implementations because they have to keep
track of the in-scope namespaces for each element whereas if they
didn't have to worry about prefixes in content they could
reconstruct the required (markup-level) namespace declarations
from the namespace URIs of elements and attributes.
I also think that this makes sense because the namespaces that
are in-scope for a particular piece of content can be application
dependent. XQuery and XPath have examples of this, where there
are several "default namespaces" in play -- one for element names
in location paths, one for function names, and another for
elements that are getting generated. In other words, there can be
several sets of "in-scope namespaces" at the content-level, so it
makes sense for those to be controlled through an
2. Enforce sanity, as defined at:
by saying that once a (markup-level) namespace is declared, it
cannot be re-declared in the same document unless it has the same
3. Don't have a default namespace -- if something has a prefix
it's in a namespace; if it doesn't, it's not. This prevents
confusion over "qualified" vs. "unqualified".
4. (A general thing, but has a particular impact with namespaces)
Have an option to retain user-specified but syntax-level
artifacts such as namespace prefixes, so that identity
transformations (for example) are able to create
identical-looking XML. For some reason, users grow attached to
the prefixes that they use and get upset when they're substituted
for 'ns0', despite the fact that the expanded names are just the