[jdom-interest] Problem with Element.getChildren()

Jason Hunter jhunter at collab.net
Tue Aug 15 10:53:14 PDT 2000


"Christophe D. Laprun" wrote:
> 
> Hi all,
> 
> After deeper examination it seems that the problem is a problem of
> namespace. I have define a default namespace for my elements. However,
> calling getChildren(name) only returns the children without namespace.
> This was my problem I guess. I don't find that very intuitive to have 
> to explicitely have to call getChildren with the namespace name when 
> you are using a default namespace. 
> Maybe a method that returns elements from
> the default namespace without having to explicetly specify it can be
> handy ?

In the past, we had getChildren() called without a specified namespace
match any children with the given local name regardless of namespace. 
Things were changed this way (where no namespace means no namespace) to
be truer to XML.  I don't see an easy middle ground, and considering new
Element("foo") creates an element with no namespace not the default
namespace, it's only right for getChildren("foo") to retrieve that same
element.

-jh-



More information about the jdom-interest mailing list