[jdom-interest] traversing the JDOM tree
Dave Bartmess
dingodave at edingo.net
Tue Apr 15 14:42:07 PDT 2003
OOPS! Missed a parameter on the internal call to recurseFind. The fixed
version is below
On Tue, 2003-04-15 at 15:35, Dave Bartmess wrote:
> try putting this in your class:
>
> public java.util.ArrayList recurseFind(Element newElem, String name) {
> java.util.ArrayList newList = newElem.getChildren(name);
> java.util.ArrayList childList = new ArrayList();
>
> java.util.Iterator iter = newList.iterator();
> while (iter.hasNext()) {
> childList.addAll(recurseFind(iter.next()), name);
> }
> newList.addAll(childList);
>
> return newList;
> }
>
> On Tue, 2003-04-15 at 10:58, Vivek Kapadekar wrote:
> > hi
> > I am using JDOM for the first time. It looks really cool, but one
> > functionality that I am looking for which is missing in it. And that is
> > for traversing the JDOM tree.
> > The getChild and getChildren gets only the elements one level deep. What
> > If i want to recursively find and Element or check existence of an
> > element, like getElementByName() or findElement().
> >
> > Thanks
> >
> > --Vivek
> >
> >
> > _______________________________________________
> > To control your jdom-interest membership:
> > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
--
David A. Bartmess
Sr. Software Configuration Manager
eDingo Enterprises
http://edingo.net
But one should not forget that money can buy a bed but not sleep,
finery but not beauty, a house but not a home,
medicine but not health, luxuries but not culture,
sex but not love, and amusements but not happiness.
More information about the jdom-interest
mailing list