I am using Xerces 2.9.1 to perform some XML parsing. The XML contains namespace and I configured Xerces to be namespace aware.
I have two prefixe defined, rec and com. rec is defined in the root tag and com is declared in each node that uses it.
<rec:root xmlns:rec="...">
<rec:dummy ...>
<com:item xmlns:com="..." />
...
I get an exception when parsing the following XPath expression:
/rec:root/rec:dummy/com:item
XPathStylesheetDOM3Exception: Prefix must resolve to a namespace: com
I found this on a blog, it talks about Xalan but I observe that Xerces has the same behavior.
Well, you might argue a design flaw, since it only uses the mapping found at the node passed to it, i.e., to top level namespace declarations in our case. So, let us move the namespace declaration to the top level, to get the following XML input
Moving the xmlns:com to the root tag fix the issue but I do not have control on that file.