[jdom-interest] jaxen/Jdom ? ancestor-or-self axis

Robert Koberg rob at koberg.com
Thu Jun 5 12:47:19 PDT 2003


Hi, 

How do you get a List of ancestor-or-self Elements with XPath?

I have tried:

String str = "ancestor-or-self::*[@id='".concat(idref).concat("']");
JDOMXPath xp = new JDOMXPath(str);
return (List)xp.selectNodes(doc.getRootElement());

I realize I recurse using getParent() and build the List, but was hoping to
use XPath.

Thanks for any help,
-Rob




More information about the jdom-interest mailing list