Description:
The ExtractXML function supports XML namespace prefixes, not namespaces. A prefix is valid only in the context of a document, not within the context of a schema-constrained document. An XPath query is not in the document context, but in the schema context. Therefore, without an explicit mapping of prefixes to namespace URIs in conjunction with a query, it is impossible to accurately select nodes from a namespace-qualified XML document.
How to repeat:
Given the XML:
<e1 xmlns="myuri1" xmlns:b="myuri3">
<a:e1 xmlns:a="myuri2">
<b:e1 xmlns:b="myuri1">content</b>
</a>
</e1>
Select the text "context" in the node named e1 in the namespace "myuri1" using ExtractXML. The closest query would probably be "/e1/a:e1/b:e2" but this leaves ambiguity on the meaning of the "b" prefix; it should not work anyway, as the root e1 element is namespaced, but no namespace is referred in the query.
Suggested fix:
Add a third (possibly optional) argument to the ExtractXML function that allows a mapping of prefixes in the query to namespace URIs. When performing XPath queries, prefixes in the query would be processed only using the mapped namespace (in the function call) against the namespace URI of given nodes in the source document, ignoring any prefixes declared in the source document.
For the above example, a good mapping would be:
a = "myuri1"
b = "myuri2"
which would allow the text to be selected with the query:
/a:e1/b:e1/a:e1