[jdom-interest] traversing the JDOM tree

Odd Moller odd.moller at cypoint.se
Wed Apr 16 01:21:27 PDT 2003


Oops! One more fix. The last method should look like this instead:

public static void traverseElementTree(Element element, String name,
Operation operation) {
   if (name != null && name.equals(element.getName())) {
      operation.operate(element);
   }
   for (Iterator i = element.getChildren().iterator(); i.hasNext();) {
      Element subElement = (Element)i.next();
      traverseElementTree(subElement, name, operation);
   }
}

///Odd Moller 


-----Original Message----- 
From: Vivek Kapadekar [mailto:vkapadekar at bitfone.com] 
Sent: den 15 april 2003 18:59 
To: jdom-interest at jdom.org 
Subject: [jdom-interest] traversing the JDOM tree 



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@yourhos
t.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20030416/f918562f/attachment.htm


More information about the jdom-interest mailing list