[jdom-interest] JDOM and XPath confusion

Thomas Scheffler thomas.scheffler at uni-jena.de
Mon Aug 21 10:18:29 PDT 2006

> I'm trying to use the JDOM implementation for XPath, and am consistently
> getting no results from any of my queries, despite following a variety
> of different documentation pages all of which claim to work.  I must be
> doing something really obvious wrong, but I can't for the life of me see
> what it is.
> /*[local-name()='mets']/*[local-name()='dmdSec']/*[local-name()='mdWrap'][@
> /mets/dmdSec/mdWrap[@MDTYPE='MODS']/xmlData/mods
> I have also tried using
> /mets:mets/mets:dmdSec/mets:mdWrap[@MDTYPE='MODS']/mets:xmlData
> to get the wrapper XML, and also replacing:
> x.addNamespace("mets", "http://www.loc.gov/METS/");

I remember that I had similar issues using a jdom tree and an xpath query. I 
would guess that you have to remove the first part of your query. Try to 
start with "*[localname]() = 'dmdSec']" and see if it returns something. Step 
by step you then build up your final xpath String that works.

Hope this tip helps a bit


More information about the jdom-interest mailing list