[jdom-interest] XPath?

Frank Sauer Frank.Sauer at trcinc.com
Wed Sep 19 15:40:02 PDT 2001


OK, here's the scoop:

I tracked it down to namespaces not matching for some reason.
If I write the expression as *:name/text() everything works.
This is with Jaxen and JDOM b7.
The element's namespace apparently is
http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd
But having no prefix in the XPath expression doesn't translate properly to
this
namespace.

Frank 

-----Original Message-----
From: bob mcwhirter [mailto:bob at werken.com]
Sent: Wednesday, September 19, 2001 3:14 PM
To: Frank Sauer
Cc: jdom-interest at jdom.org
Subject: Re: [jdom-interest] XPath?


On Wed, 19 Sep 2001, Frank Sauer wrote:

> I'm trying to use an XPath engine with JDOM to obtain the textual
> content of the <name> element under the <tag> element in a taglib tld
> file. I tried to use both werken.xpath and jaxen, but can't
> get either to work. The context node is the <tag> element, so I tried
> all of the following expressions:
> 
> name

	This should select the <name> org.jdom.Element

> name/text()

	This *should* select the string-value of the org.jdom.Element,
	which recursively constructs the string based upon sub-elements
	too.

> child::name

	This is the same as 'name' above.

> child::name/text()

	This is the same as 'name/text()' above.

> /name

	This will only select the root element if its
	a <name> tag, else an empty-set will be returned.

> //name

	This will select all <name> elements within your
	document.

My question now:

*Which* XPath engine are you using?

	-bob



More information about the jdom-interest mailing list