Link to home
Start Free TrialLog in
Avatar of Juuno
Juuno

asked on

Case-insensitive XPath Expression

If my xml file structure is like this:
<file>
      <entry>
            <name>
            <count>
      </entry>
      <entry>
            <name>
            <count>
      </entry>
      ...
</file>

Then, the following xpath expression is to get the 'count' for the matched name with user inputted name.
Here's inputname is a variable which I 'll get input from the user. Right?

XPathExpression expr = xpath
      .compile("//file/entry[name='" + inputname + "']//count/text()");
      
But it is case-sensitive, i mean if the user input is "Car" and if the name is "car". It cannot match because it is case-sensitive.
So, what I would like to know is .. can I tell xpathexpression not to be case-sensitive.
Is there anyway?

Thanks!!
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial