[jdom-interest] Element.getChildren() doesn't work ??

Omen Red omenred at yahoo.com
Mon Sep 18 10:59:08 PDT 2000

Hi there,
 recently I have downloaded jdom-b3 and tryied to use
in my work, but what I found is that 
when I call function getChildren() in Element it
returns me list with doubled count of subelements.
For instance when I build document from 
"<A1><A2></A2><A2></A2></A1>" and call then
getChildren() for root element, I receive not 2 A2
elements but four!! Is it ok ? 
I went to the sources of jdom and found getChildren
function, and found following:

>>    public List getChildren() {
>>        PartialList elements = new
>>        Iterator i = content.iterator();
>>        while (i.hasNext()) {
>>            Object obj = i.next();
>>            if (obj instanceof Element) {
>>                elements.addPartial(obj);
>>            }
>>        }
>>        return elements;
>>    }

As I understand from code above, first of all List of
subelements is created from "content" and then all
elements of "content" are added again. 
I don't get it. Of course I can use getMixedContent()
but what is the purpose of getChildren() function then

Thanx, best regards,

Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!

More information about the jdom-interest mailing list