I have a XML file like this
<a:books xmlns:a="ans">
<a:book>
<a:id> 1 </a:id>
<a:title>The first book</a:title>
</a:book>
</a:books>
By default, IE recognizes the a prefixes from the xml itself when I do a XPath query on it
x.selectNodes('//a:book').length //gives 1, as desired
But if I tell it to use the XPath selection language to go along with the other browsers then it stops recognizing the prefixes used in the original XML.
x.setProperty('SelectionLanguage', 'XPath')
x.selectNodes('//a:book').length
//throws an error: "Referência a um prefixo de espaço para nome não declarado: 'a'."
// I would translate it as "reference to an undeclared namespace prefix".
I know I can use x.setProperty('SelectionNamespaces', "xmlns:a='ans'") to stop the error but is there a way to programatically get the a->ans relation, like I can by using x.createNSResolver(x) in the other browsers?
You would need to access any namespace declaration attributes in the DOM and that way infer the prefix->namespace URI bindings yourself, MSXML (which IE uses) does not have any method like
createNSResolver.[edit]
Here is some sample code: