[jdom-interest] Namespace patch

Brett McLaughlin brett.mclaughlin at lutris.com
Tue Aug 29 12:33:32 PDT 2000


Elliotte Rusty Harold wrote:
> 
> At 7:52 PM +0200 8/29/00, Anli Shundi wrote:
> >This is to reiterate my earlier concerns on Namespace declarations
> >which get lost.  The current version optimizes and uses namespaces
> >only when explicitly needed.  Their declaration should not get lost.
> >Digital Signature's Canonicalization algorithm needs them as well.
> >http://www.w3.org/TR/xml-c14n
> >
> 
> The big question is whether anyone cares where the namespace prefixes
> are declared as long as they're declared; i.e. would it matter if a
> namespace declaration moved from a child node to a parent node?
> 
> Simply holding on to all namespace declarations is not hard. Making
> sure they stay in one place is hard given the current architecture.
> Doing this seems like it would require a separate
> NamespaceDeclaration class which could be attached to particular
> elements. This would require major changes to Element, Attribute, and
> Namespace.
> 
> It might also require changes to how client programmers work with
> JDOM. Right now you can add any element as a child of any other
> element, and any attribute to any element and the namespaces will
> sort themselves out. I'm not sure if we can maintain that simplicity
> if we allow people to directly add namespace declarations.  Maybe we
> can. I need to think about it some more.

Right. Originally, we had things this way - addNamespaceDeclaration()
and so forth. And though it was a bit different, we came up with the
notion (which I still agree with) that an Element needs to know its
namespace declaration, because it's intrinsic to what the Element
actually is. But that aside, I'm not objectionable to an Element holding
onto other declarations; the hardest thing becomes what happens to an
Element being added, presumably one in the "Default" namespace, to an
Element with a default namespace declaration. Currently, it does what I
consider the right thing; only an Element with a Namespace has a
Namespace, and no "magic" happens behind the back of the user; but with
this proposed change, that isn't so obvious.

Thoughts?

-Brett

> 
> +-----------------------+------------------------+-------------------+
> | 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/     |
> +----------------------------------+---------------------------------+
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

-- 
Brett McLaughlin, Enhydra Strategist
Lutris Technologies, Inc. 
1200 Pacific Avenue, Suite 300 
Santa Cruz, CA 95060 USA 
http://www.lutris.com
http://www.enhydra.org



More information about the jdom-interest mailing list