XPath with namespace does not get the expected result [duplicate]
Solution 1:
While calling setNamespaceContext()
might seem to suffice to indicate intent to use namespaces, it actually also takes a call to DocumentBuilderFactory.setNamespaceAware(true).
See also How does XPath deal with XML namespaces?