[jdom-interest] XmlOutputter - printNamespace - NO_NAMESPACE outputs xmlns="", bug?

Elliotte Rusty Harold elharo at metalab.unc.edu
Thu Jul 3 08:36:09 PDT 2003


At 4:53 PM +0200 7/3/03, Eric VERGNAUD wrote:


>Yes it does, it gets the null namespace, and loses the 'current' namespace.
>Let's not be religious about this. I think this could be improved by
>creating (in JDOM) a default PARENT namespace, so that when creating a new
>Element with no namespace, it would get -if any- the namespace on top of the
>namespace stack, instead of NONAMESPACE. Since this has backward
>compatibility issues, it would require to set a pref somewhere in the JDOM
>initialization process.
>
>Don't you think it's an idea ?


It's an idea, just a bad one. We've been over this umpteen-dozen 
times. What you are asking for is based on a fundamental 
misunderstanding of namespaces in XML. That's not surprising. 
Namespaces in XML is a messy, poorly designed spec that confuses 
people. But it would be far more confusing for JDOM to try to fix 
this. The solution JDOM has is the right one. Every element has a 
name and a namespace. Neither the name nor the namespace changes 
without an explicit request to do so.
-- 

   Elliotte Rusty Harold
   elharo at metalab.unc.edu
   Processing XML with Java (Addison-Wesley, 2002)
   http://www.cafeconleche.org/books/xmljava
   http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA



More information about the jdom-interest mailing list