[jdom-interest] Searching tree for all elements

Darren Gibbons dgibbons at openroad.ca
Sat Nov 11 01:08:37 PST 2000


Hi all,

I'm new to JDOM, but I'm excited by what I've seen so far.  My question is
regarding the ability to load an XML document and perform a query that
returns all children with a specific name, regardless of their position in
the structure of the document.

For example, I'd like to be able to load an XHTML document, and perform a
query to retrieve all INPUT elements.

getChildren() only returns the direct children of an Element.  A brute force
way to do this would be to write a function that recurses over all the
elements, and returns the elements that match.  However, I was wondering if
there was a more optimal way to do this.

Thanks for the help,

Darren.

--
Darren Gibbons                                    dgibbons at openroad.ca
OpenRoad Communications                               ph: 604.681.0516
Internet Application Development                     fax: 604.681.0916
Vancouver, B.C.                                 http://www.openroad.ca




More information about the jdom-interest mailing list