XPathEvaluator.createNSResolver()

This method adapts any DOM node to resolve namespaces so that an XPath expression can be easily evaluated relative to the context of the node where it appeared within the document.

This adapter works like the DOM Level 3 method Node.lookupNamespaceURI() in resolving the namespace URI from a given prefix using the current information available in the node's hierarchy at the time the method is called, also correctly resolving the implicit xml prefix.

Syntax

XPathNSResolver XPathEvaluator.createNSResolver(nodeResolver);

Parameters

nodeResolver

A Node to be used as a context for namespace resolution.

Return value

An XPathNSResolver object which resolves namespaces with respect to the definitions in scope for a specified node.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
createNSResolver
1
12
1
No
≤12.1
3
1
18
4
≤12.1
1
1.0

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/XPathEvaluator/createNSResolver