permaculture playing cards
The moose likes XML and Related Technologies and the fly likes Strange behaviour with CachedXPathAPI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Strange behaviour with CachedXPathAPI" Watch "Strange behaviour with CachedXPathAPI" New topic

Strange behaviour with CachedXPathAPI

Jag Bains
Ranch Hand

Joined: Nov 19, 2002
Posts: 39
I have a strange problem when using CachedXPathAPI.selectNodeList(node, nodeName);
If the nodename is replace with a string literal e.g

or with a variable name that uses a literal e.g

Then the nodelist is retured perfectly fine.
However, if the nodeName comes from a hashMap e.g.

then I get the following exception:

Has anyone got any ideas why this is happening or how I can get around it?
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi Jag,
If you add a debug statement showing the value of your string (coming from the hashmap), you may discover that the problem is not with the XPathAPI but rather with the value you assign to the "NODENAME" key.
Jag Bains
Ranch Hand

Joined: Nov 19, 2002
Posts: 39
yes you are right. The value in my hashmap actually had " a round the text.
Stupid me.
I agree. Here's the link:
subject: Strange behaviour with CachedXPathAPI
It's not a secret anymore!