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 前缀。

句法

XPathNSResolver XPathEvaluator.createNSResolver(nodeResolver);
					

参数

nodeResolver
节点 to be used as a context for namespace resolution.

返回值

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

规范

规范 状态 注释
DOM (文档对象模型) 3 级 XPath 规范
The definition of 'XPathEvaluator.createNSResolver()' in that specification.
推荐 初始定义

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

No compatibility data found. Please contribute data for "api.XPathEvaluator.createNSResolver" (depth: 1) to the MDN 兼容性数据存储库 .

另请参阅

元数据

  • 最后修改:
  1. XPathEvaluator
  2. 方法
    1. createExpression()
    2. createNSResolver()
    3. evaluate()
  3. 实现通过:
    1. Document