[jdom-interest] getChild with Attribute

Dave Writz dave.writz at cornerstone.net
Mon Apr 2 20:23:25 PDT 2001


Is it possible to get a child of an element based on a attribute value
without using XPath?  I have been able to get it working with XPath, but am
hoping for a cleaner implementation.

What I am looking for is something like the following:

String  value   = document.getRootElement().root.getChild("ElementName", new
Attribute("name", "value")).getText();

This of course would return the first child element that matched the name
and contained the attribute.

Ideally this could be extended to support a multiple attribute list.


Thanks

-Dave





More information about the jdom-interest mailing list