mozilla

Revision 110811 of Introduction to using XPath in JavaScript

  • Revision slug: Introduction_to_using_XPath_in_JavaScript
  • Revision title: Introduction to using XPath in JavaScript
  • Revision id: 110811
  • Created:
  • Creator: Jt
  • Is current revision? No
  • Comment

Revision Content

Introduction

This document describes the interface to access XPath functions from JavaScript.

Mozilla implements much of the DOM 3 XPath. This allows XPath expressions to be run against both HTML and XML documents.

The simplest interface to XPath is the DOM:document.evaluate evaluate function of the document object, which returns an object of type XPathResult:


var xpathResult = document.evaluate(xpathExpression, contextNode, namespaceResolver, resultType, result);

Revision Source

<h3 name="Introduction">Introduction</h3>
<p>This document describes the interface to access <a href="en/XPath">XPath</a> functions from JavaScript.
</p><p>Mozilla implements much of the <a class="external" href="http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html">DOM 3 XPath</a>. This allows XPath expressions to be run against both HTML and XML documents.
</p><p>The simplest interface to XPath is the <a href="en/DOM/document.evaluate_evaluate">DOM:document.evaluate evaluate</a> function of the document object, which returns an object of type XPathResult:
</p><p><br>
</p>
<pre>var xpathResult = document.evaluate(xpathExpression, contextNode, namespaceResolver, resultType, result);
</pre>
Revert to this revision