I have looked and tried solutions given, but I can't get any to work for my xpath. Using Java 7 through Tomcat7 (through a JSP page) Here's my sample XML:
<table name='phonebook'>
<record>
<field name='fname'>John</field>
<field name='lname'>Dee</field>
<field name='City'>London</field>
<field name='Phone'>020123</field>
</record>
<record>
<field name='fname'>JOHN</field>
<field name='lname'>Smith</field>
<field name='City'>london</field>
<field name='Phone'>020456</field>
</record>
<record>
<field name='fname'>Marble</field>
<field name='lname'>SMith</field>
<field name='City'>Bristol</field>
<field name='Phone'>0117123</field>
</record>
</table>
</database>
I have a search (which works fine) but it is case sensitive. Note that I spelled John, London and Smith with different cases, and I want those to match when I search. So how to find them with a case in-senstive search? Here's my Java/XPATH:
XPathExpression expr = xpath.compile("//table[@name='phonebook']/record[upper-case(field[@name='fname'])='JOHN']");
So here I want to find all records that have an fname of value JOHN regardless of upper/lower case. It gives me a javax.xml.xpath.XPathExpressionException. When I take away the 'upper-case( .... )' it works (but case sensitive). I've also tried 'match()' with no success.