Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

Re: [jdom-interest] JDOM and XPath confusion

Thomas Scheffler

2006-08-21

Replies:

> 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'][@
>MDTYPE='MODS']/*[local-name()='xmlData']/*[local-name()='mods']
>
> /mets/dmdSec/mdWrap[@(protected)
>
> I have also tried using
>
> /mets:mets/mets:dmdSec/mets:mdWrap[@(protected)
>
> 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

Thomas
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.