File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Strange behaviour with CachedXPathAPI

 
Jag Bains
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes you are right. The value in my hashmap actually had " a round the text.
Stupid me.
Jag
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic