This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Strange behaviour with CachedXPathAPI Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "Strange behaviour with CachedXPathAPI" Watch "Strange behaviour with CachedXPathAPI" New topic
Author

Strange behaviour with CachedXPathAPI

Jag Bains
Ranch Hand

Joined: Nov 19, 2002
Posts: 39
Hi,
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?
Thanks
Jag
Anonymous
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.
Regards
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.
Jag
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Strange behaviour with CachedXPathAPI
 
Similar Threads
Suppress text nodes in output when empty
xml JAVA
reading xml document by parsing
XML dealing with the NamedNodeMap interface
Jtree adding nodes