[jdom-interest] API instability?

Jason Hunter jhunter at collab.net
Thu Aug 31 09:05:28 PDT 2000

> >    - change Element.getChild(String) so that it uses the
> >      namespace of the parent instead of the default namespace;
> >      if you want the default namespace, you can always pass null
> Ah.... this will never get in, because it has some very subtle bugs. A
> namespace is part of an Element, not part of an Element's scope. You are
> going to run into some tricky bugs when you start moving elements
> between documents, or within a document where the namespace scopes
> aren't the same. I would advise against this - the trouble of adding the
> Namespace is minor, IMO.

I'm not sure it's the right thing to go this way but let's look it
over.  I don't see what bugs you'd have when moving elements between
docs.  The simple idea is that if you have


When you say parent.getChild("child") it's kinda natural for the
unspecified namespace of "child" to be the same as the parent, not the
no-namespace.  It's a simple way of thinking: ask Bob Jones about his
kid Billy and he naturally refers to the Billy in the Jones namespace. 

Using the XML default makes the one-arg version of getChild() pretty
much useless in a "namespaced" document.  One cool thing with this
change is that if you had that <JavaXML:chapter> content you use in your
book then once you got the root you could just use getChild()
everywhere.  Kinda nice.


More information about the jdom-interest mailing list