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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Namespaces

[ Lists Home | Date Index | Thread Index ]

Hi Mike,

> 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 [1] 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
namespaces:

  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
     application-specific mechanism.

  2. Enforce sanity, as defined at:

       http://www.flightlab.com/~joe/sgml/sanity.txt

     by saying that once a (markup-level) namespace is declared, it
     cannot be re-declared in the same document unless it has the same
     prefix.

  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
     same.

Cheers,

Jeni

[1] http://www.lmnl.org/

---
Jeni Tennison
http://www.jenitennison.com/





 

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

Copyright 2001 XML.org. This site is hosted by OASIS