<h1>xercesc::DOMXPathEvaluator Class Reference</h1><!-- doxytag: class="xercesc::DOMXPathEvaluator" -->The evaluation of XPath expressions is provided by <code><aclass="el"href="classxercesc_1_1DOMXPathEvaluator.html">DOMXPathEvaluator</a></code>.
Inheritance diagram for xercesc::DOMXPathEvaluator:<p><center><imgsrc="classxercesc_1_1DOMXPathEvaluator__inherit__graph.png"border="0"usemap="#xercesc_1_1DOMXPathEvaluator__inherit__map"alt="Inheritance graph"></center>
<center><fontsize="2">[<ahref="graph_legend.html">legend</a>]</font></center><ahref="classxercesc_1_1DOMXPathEvaluator-members.html">List of all members.</a><tableborder="0"cellpadding="0"cellspacing="0">
<tr><td></td></tr>
<tr><tdcolspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><tdcolspan="2"><divclass="groupHeader">Functions introduced in DOM Level 3</div></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Creates a parsed XPath expression with resolved namespaces. <ahref="#e389bf7c8aa48313cfb275a86df86708"></a><br></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">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. <ahref="#bbb342ea61f485cf714df7cac5039f0d"></a><br></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Evaluates an XPath expression string and returns a result of the specified type if possible. <ahref="#18c221115c600a8ae6b94b587a48a340"></a><br></td></tr>
In a DOM implementation which supports the XPath 3.0 feature, the <code><aclass="el"href="classxercesc_1_1DOMXPathEvaluator.html">DOMXPathEvaluator</a></code> interface will be implemented on the same object which implements the Document interface permitting it to be obtained by casting or by using the DOM Level 3 getInterface method. In this case the implementation obtained from the Document supports the XPath DOM module and is compatible with the XPath 1.0 specification. Evaluation of expressions with specialized extension functions or variables may not work in all implementations and is, therefore, not portable. XPathEvaluator implementations may be available from other sources that could provide specific support for specialized extension functions or variables as would be defined by other specifications. <dlclass="since"compact><dt><b>Since:</b></dt><dd>DOM Level 3 </dd></dl>
Creates a parsed XPath expression with resolved namespaces.
<p>
This is useful when an expression will be reused in an application since it makes it possible to compile the expression string into a more efficient internal form and preresolve all namespace prefixes which occur within the expression. <dlcompact><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"></td><tdvalign="top"><em>expression</em> </td><td>of type XMLCh - The XPath expression string to be parsed. </td></tr>
<tr><tdvalign="top"></td><tdvalign="top"><em>resolver</em> </td><td>of type <code>XPathNSResolver</code> - The resolver permits translation of all prefixes, including the xml namespace prefix, within the XPath expression into appropriate namespace URIs. If this is specified as null, any namespace prefix within the expression will result in <code><aclass="el"href="classxercesc_1_1DOMException.html">DOMException</a></code> being thrown with the code NAMESPACE_ERR. </td></tr>
<tr><tdvalign="top"></td><tdvalign="top"><em><code>XPathException</code></em> </td><td>INVALID_EXPRESSION_ERR: Raised if the expression is not legal according to the rules of the <code><aclass="el"href="classxercesc_1_1DOMXPathEvaluator.html">DOMXPathEvaluator</a></code>. </td></tr>
<tr><tdvalign="top"></td><tdvalign="top"><em><aclass="el"href="classxercesc_1_1DOMException.html">DOMException</a></em> </td><td>NAMESPACE_ERR: Raised if the expression contains namespace prefixes which cannot be resolved by the specified <code>XPathNSResolver</code>. </td></tr>
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.
<p>
This adapter works like the DOM Level 3 method lookupNamespaceURI on nodes in resolving the namespaceURI from a given prefix using the current information available in the node's hierarchy at the time lookupNamespaceURI is called. also correctly resolving the implicit xml prefix. <dlcompact><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"></td><tdvalign="top"><em>nodeResolver</em> </td><td>of type <code><aclass="el"href="classxercesc_1_1DOMNode.html">DOMNode</a></code> The node to be used as a context for namespace resolution. </td></tr>
<dlclass="return"compact><dt><b>Returns:</b></dt><dd><code>XPathNSResolver</code><code>XPathNSResolver</code> which resolves namespaces with respect to the definitions in scope for a specified node. </dd></dl>
Evaluates an XPath expression string and returns a result of the specified type if possible.
<p>
<dlcompact><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"></td><tdvalign="top"><em>expression</em> </td><td>of type XMLCh The XPath expression string to be parsed and evaluated. </td></tr>
<tr><tdvalign="top"></td><tdvalign="top"><em>contextNode</em> </td><td>of type <code><aclass="el"href="classxercesc_1_1DOMNode.html">DOMNode</a></code> The context is context node for the evaluation of this XPath expression. If the <code><aclass="el"href="classxercesc_1_1DOMXPathEvaluator.html">DOMXPathEvaluator</a></code> was obtained by casting the <code><aclass="el"href="classxercesc_1_1DOMDocument.html">DOMDocument</a></code> then this must be owned by the same document and must be a <code><aclass="el"href="classxercesc_1_1DOMDocument.html">DOMDocument</a></code>, <code><aclass="el"href="classxercesc_1_1DOMElement.html">DOMElement</a></code>, <code>DOMAttribute</code>, <code><aclass="el"href="classxercesc_1_1DOMText.html">DOMText</a></code>, <code><aclass="el"href="classxercesc_1_1DOMCDATASection.html">DOMCDATASection</a></code>, <code><aclass="el"href="classxercesc_1_1DOMComment.html">DOMComment</a></code>, <code><aclass="el"href="classxercesc_1_1DOMProcessingInstruction.html">DOMProcessingInstruction</a></code>, or <code>XPathNamespace</code> node. If the context node is a <code><aclass="el"href="classxercesc_1_1DOMText.html">DOMText</a></code> or a <code><aclass="el"href="classxercesc_1_1DOMCDATASection.html">DOMCDATASection</a></code>, then the context is interpreted as the whole logical text node as seen by XPath, unless the node is empty in which case it may not serve as the XPath context. </td></tr>
<tr><tdvalign="top"></td><tdvalign="top"><em>resolver</em> </td><td>of type <code>XPathNSResolver</code> The resolver permits translation of all prefixes, including the xml namespace prefix, within the XPath expression into appropriate namespace URIs. If this is specified as null, any namespace prefix within the expression will result in <code><aclass="el"href="classxercesc_1_1DOMException.html">DOMException</a></code> being thrown with the code NAMESPACE_ERR. </td></tr>
<tr><tdvalign="top"></td><tdvalign="top"><em>type</em> </td><td>of type unsigned short - If a specific type is specified, then the result will be returned as the corresponding type. For XPath 1.0 results, this must be one of the codes of the <code>XPathResult</code> interface. </td></tr>
<tr><tdvalign="top"></td><tdvalign="top"><em>result</em> </td><td>of type void* - The result specifies a specific result object which may be reused and returned by this method. If this is specified as null or the implementation does not reuse the specified result, a new result object will be constructed and returned. For XPath 1.0 results, this object will be of type <code>XPathResult</code>. </td></tr>
<dlclass="return"compact><dt><b>Returns:</b></dt><dd>void* The result of the evaluation of the XPath expression. For XPath 1.0 results, this object will be of type <code>XPathResult</code>. </dd></dl>
<tr><tdvalign="top"></td><tdvalign="top"><em><code>XPathException</code></em> </td><td>INVALID_EXPRESSION_ERR: Raised if the expression is not legal according to the rules of the <code><aclass="el"href="classxercesc_1_1DOMXPathEvaluator.html">DOMXPathEvaluator</a></code> TYPE_ERR: Raised if the result cannot be converted to return the specified type. </td></tr>
<tr><tdvalign="top"></td><tdvalign="top"><em><aclass="el"href="classxercesc_1_1DOMException.html">DOMException</a></em> </td><td>NAMESPACE_ERR: Raised if the expression contains namespace prefixes which cannot be resolved by the specified <code>XPathNSResolver</code>. WRONG_DOCUMENT_ERR: The Node is from a document that is not supported by this <code><aclass="el"href="classxercesc_1_1DOMXPathEvaluator.html">DOMXPathEvaluator</a></code>. NOT_SUPPORTED_ERR: The Node is not a type permitted as an XPath context node or the request type is not permitted by this <code><aclass="el"href="classxercesc_1_1DOMXPathEvaluator.html">DOMXPathEvaluator</a></code>. </td></tr>