My XML is like below:
<?xml version="1.0"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<mime-mapping>
<extension>123</extension>
<mime-type>application/vnd.lotus-1-2-3</mime-type>
</mime-mapping>
<mime-mapping>
<extension>3dml</extension>
<mime-type>text/vnd.in3d.3dml</mime-type>
</mime-mapping>
</web-app>
As you see, it has namespace so default xpath such as /web-app/mime-mapping/mime-type
will not work.
Based on my reading on various threads, I tried:
/*[local-name()='web-app']/*[local-name()='mime-mapping']/*[local-name()='mime-type']
AND
/*[name()='web-app']/*[name()='mime-mapping']/*[name()='mime-type']
AND
/*[name()='web-app' and namespace-uri()='http://java.sun.com/xml/ns/javaee']/*[name()='mime-mapping' and namespace-uri()='http://java.sun.com/xml/ns/javaee']/*[name()='mime-type' and namespace-uri()='http://java.sun.com/xml/ns/javaee']
But none seem to work. I am testing in http://www.freeformatter.com/xpath-tester.html. Also, I am testing in my tool which requires XPath 1.0 and it does not recognize any of the above either.
Any pointers?