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

Brett McLaughlin brett.mclaughlin at lutris.com
Mon Sep 18 11:26:44 PDT 2000


Omen Red wrote:
> 
> 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:

Get the latest version from CVS. Beta 3 and 4 are horribly behind.

Thanks,
Brett

> 
> >>    public List getChildren() {
> >>        PartialList elements = new
> PartialList(content);
> >>
> >>        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,
> omen.
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/
> _______________________________________________
> 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