Is there a method I can grab parent/grandparent nodes? The examples I have found appear to use only xpath statements to select nodes. Some of my failed attempts:

/table/tr/td/b/font[self::text()="Nohup Files"]
/table/descendant::font[self::text()="Nohup Files"]

<td><b><font>Nohup Files</font></b></td>

table[tr/td/b/font='Nohup Files'] seems to work for getting the table element, if that's what you are wanting. I tried it out with the following structure

        <tr><td><b><font>Not this one</font></b></td></tr>
        <tr><td><b><font>Nohup Files</font></b></td></tr>

Thanks! In my fumblings, I was able to piece together this: //font[self::text()="Nohup Files"]/ancestor::table. Your test xml is exactly what I am working with. What code/classes did you use to test yours?

This uses the JDOM packages.

org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder();
Document doc = File("test.xml"));
XPath xp = XPath.newInstance("table[tr/td/b/font='Nohup Files']");
List<Element> result = xp.selectNodes(doc.getRootElement());
XMLOutputter out = new XMLOutputter();
for(Element e: result){
This question has already been answered. Start a new discussion instead.