[jdom-interest] Additional namespace issues

Elliotte Rusty Harold elharo at metalab.unc.edu
Fri Dec 15 06:41:38 PST 2000


At 9:40 PM -0800 12/14/00, Jason Hunter wrote:
>Two issues:
>
>First, in Element we have addNamespaceDeclaration() and
>getAdditionalNamespaces().  Seems to me these names should be more
>similar to each other.  But what's best?
>
>Second, there's no removeNamespaceDeclaration().  Seems we should have
>that functionality also.  Any reason not to?
>

I'd actually like to propose a more radical shift, though I'm not the 
first to propose this idea.  It has been brought up before.

Instead of (or perhaps in addition to) getAdditionalNamespaces() 
there should be a getNamespacesInScope() method that returns a list 
of all the namespaces which apply to that element. This is what's 
needed for resolving namespace prefixes in attribute values, for 
example.

The only real need for getAdditionalNamespaces() is for XMLOutputter. 
What we really need here is a friend function. Unfortunately Java 
doesn't have friend functions. :-(  But if we do keep it I agree with 
renaming it getNamespaceDeclarations()
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|                  The XML Bible (IDG Books, 1999)                   |
|              http://metalab.unc.edu/xml/books/bible/               |
|   http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ |
|  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list