commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vaibhav Kumthekar <vaibhav_kumthe...@persistent.co.in>
Subject JXPathContext returns null for some xml documents if element have first character in upper case
Date Wed, 26 Aug 2009 04:05:40 GMT
Hi All,



I am using JXPath in my code and facing some strange issue. I parsed 2 XMLs:

1. <myName><name>vaibhav<name><myName>



2. <MyName><Name>vaibhav<Name><MyName>



In first case, my xpath "/getName/name" gives me the correct value i.e. 'vaibhav'. But in
second case, "/GetName/Name" gives me null (I have set lenient = true). Somehow JXPath can't
find the path and hence return null. Here, in second case, if I give JXPath Expression as
"/getName/name" then only it gives me value as 'vaibhav'.



I have found similar changes in case of use of '_'(underscore). e.g. x_Name. My xpath needs
to change for such kind of XMLs.



Is it a bug or normal behaviour?



Normally user gives JXPath expression depending on XML document that he wants to parse. Thus
both Expression and XML Document can be consistent. And hence I think that the JXPath should
not change the case of first letter. JXPath expression should remain as is (i.e. same as what
user has provided)





If anyone have any suggestion please pitch in.



Thanks,

Vaibhav

DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent
Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed.
If you are not the intended recipient, you are not authorized to read, retain, copy, print,
distribute or use this message. If you have received this communication in error, please notify
the sender and delete all copies of this message. Persistent Systems Ltd. does not accept
any liability for virus infected mails.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message