1 <?xml version="1.0" encoding="ascii"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3 "DTD/xhtml1-transitional.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6 <title>lxml.etree.XPathElementEvaluator</title>
7 <link rel="stylesheet" href="epydoc.css" type="text/css" />
8 <script type="text/javascript" src="epydoc.js"></script>
11 <body bgcolor="white" text="black" link="blue" vlink="#204080"
13 <!-- ==================== NAVIGATION BAR ==================== -->
14 <table class="navbar" border="0" width="100%" cellpadding="0"
15 bgcolor="#a0c0ff" cellspacing="0">
18 <th> <a
19 href="lxml-module.html">Home</a> </th>
22 <th> <a
23 href="module-tree.html">Trees</a> </th>
26 <th> <a
27 href="identifier-index.html">Indices</a> </th>
30 <th> <a
31 href="help.html">Help</a> </th>
33 <!-- Project homepage -->
34 <th class="navbar" align="right" width="100%">
35 <table border="0" cellpadding="0" cellspacing="0">
36 <tr><th class="navbar" align="center"
37 ><a class="navbar" target="_top" href="/">lxml API</a></th>
41 <table width="100%" cellpadding="0" cellspacing="0">
44 <span class="breadcrumbs">
45 <a href="lxml-module.html">Package lxml</a> ::
46 <a href="lxml.etree-module.html">Module etree</a> ::
47 Class XPathElementEvaluator
51 <table cellpadding="0" cellspacing="0">
52 <!-- hide/show private -->
53 <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
54 onclick="toggle_private();">hide private</a>]</span></td></tr>
55 <tr><td align="right"><span class="options"
56 >[<a href="frames.html" target="_top">frames</a
57 >] | <a href="lxml.etree.XPathElementEvaluator-class.html"
58 target="_top">no frames</a>]</span></td></tr>
63 <!-- ==================== CLASS DESCRIPTION ==================== -->
64 <h1 class="epydoc">Class XPathElementEvaluator</h1><p class="nomargin-top"></p>
65 <pre class="base-tree">
68 <a href="lxml.etree._XPathEvaluatorBase-class.html" onclick="show_private();">_XPathEvaluatorBase</a> --+
70 <strong class="uidshort">XPathElementEvaluator</strong>
73 <dl><dt>Known Subclasses:</dt>
75 <ul class="subclass-list">
76 <li><a href="lxml.etree.XPathDocumentEvaluator-class.html">XPathDocumentEvaluator</a></li> </ul>
80 <p>XPathElementEvaluator(self, element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
81 Create an XPath evaluator for an element.</p>
82 <p>Absolute XPath expressions (starting with '/') will be evaluated against
83 the ElementTree as returned by getroottree().</p>
84 <p>Additional namespace declarations can be passed with the
85 'namespace' keyword argument. EXSLT regular expression support
86 can be disabled with the 'regexp' boolean keyword (defaults to
87 True). Smart strings will be returned for string results unless
88 you pass <tt class="rst-docutils literal">smart_strings=False</tt>.</p>
90 <!-- ==================== INSTANCE METHODS ==================== -->
91 <a name="section-InstanceMethods"></a>
92 <table class="summary" border="1" cellpadding="3"
93 cellspacing="0" width="100%" bgcolor="white">
94 <tr bgcolor="#70b0f0" class="table-header">
95 <td colspan="2" class="table-header">
96 <table border="0" cellpadding="0" cellspacing="0" width="100%">
98 <td align="left"><span class="table-header">Instance Methods</span></td>
99 <td align="right" valign="top"
100 ><span class="options">[<a href="#section-InstanceMethods"
101 class="privatelink" onclick="toggle_private();"
102 >hide private</a>]</span></td>
108 <td width="15%" align="right" valign="top" class="summary">
109 <span class="summary-type"> </span>
110 </td><td class="summary">
111 <table width="100%" cellpadding="0" cellspacing="0" border="0">
113 <td><span class="summary-sig"><a href="lxml.etree.XPathElementEvaluator-class.html#__call__" class="summary-sig-name">__call__</a>(<span class="summary-sig-arg">self</span>,
114 <span class="summary-sig-arg">_path</span>,
115 <span class="summary-sig-arg">**_variables</span>)</span><br />
116 Evaluate an XPath expression on the document.</td>
117 <td align="right" valign="top">
127 <td width="15%" align="right" valign="top" class="summary">
128 <span class="summary-type"> </span>
129 </td><td class="summary">
130 <table width="100%" cellpadding="0" cellspacing="0" border="0">
132 <td><span class="summary-sig"><a href="lxml.etree.XPathElementEvaluator-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
133 <span class="summary-sig-arg">element</span>,
134 <span class="summary-sig-arg">namespaces</span>=<span class="summary-sig-default">None</span>,
135 <span class="summary-sig-arg">extensions</span>=<span class="summary-sig-default">None</span>,
136 <span class="summary-sig-arg">regexp</span>=<span class="summary-sig-default">True</span>,
137 <span class="summary-sig-arg">smart_strings</span>=<span class="summary-sig-default">True</span>)</span><br />
138 x.__init__(...) initializes x; see help(type(x)) for signature</td>
139 <td align="right" valign="top">
149 <td width="15%" align="right" valign="top" class="summary">
150 <span class="summary-type">a new object with type S, a subtype of T</span>
151 </td><td class="summary">
152 <table width="100%" cellpadding="0" cellspacing="0" border="0">
154 <td><span class="summary-sig"><a href="lxml.etree.XPathElementEvaluator-class.html#__new__" class="summary-sig-name">__new__</a>(<span class="summary-sig-arg">T</span>,
155 <span class="summary-sig-arg">S</span>,
156 <span class="summary-sig-arg">...</span>)</span></td>
157 <td align="right" valign="top">
167 <td width="15%" align="right" valign="top" class="summary">
168 <span class="summary-type"> </span>
169 </td><td class="summary">
170 <table width="100%" cellpadding="0" cellspacing="0" border="0">
172 <td><span class="summary-sig"><a name="register_namespace"></a><span class="summary-sig-name">register_namespace</span>(<span class="summary-sig-arg">...</span>)</span><br />
173 Register a namespace with the XPath context.</td>
174 <td align="right" valign="top">
184 <td width="15%" align="right" valign="top" class="summary">
185 <span class="summary-type"> </span>
186 </td><td class="summary">
187 <table width="100%" cellpadding="0" cellspacing="0" border="0">
189 <td><span class="summary-sig"><a name="register_namespaces"></a><span class="summary-sig-name">register_namespaces</span>(<span class="summary-sig-arg">...</span>)</span><br />
190 Register a prefix -> uri dict.</td>
191 <td align="right" valign="top">
201 <td colspan="2" class="summary">
202 <p class="indent-wrapped-lines"><b>Inherited from <code><a href="lxml.etree._XPathEvaluatorBase-class.html" onclick="show_private();">_XPathEvaluatorBase</a></code></b>:
203 <code><a href="lxml.etree._XPathEvaluatorBase-class.html#evaluate">evaluate</a></code>
205 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
206 <code>__delattr__</code>,
207 <code>__format__</code>,
208 <code>__getattribute__</code>,
209 <code>__hash__</code>,
210 <code>__reduce__</code>,
211 <code>__reduce_ex__</code>,
212 <code>__repr__</code>,
213 <code>__setattr__</code>,
214 <code>__sizeof__</code>,
215 <code>__str__</code>,
216 <code>__subclasshook__</code>
221 <!-- ==================== PROPERTIES ==================== -->
222 <a name="section-Properties"></a>
223 <table class="summary" border="1" cellpadding="3"
224 cellspacing="0" width="100%" bgcolor="white">
225 <tr bgcolor="#70b0f0" class="table-header">
226 <td colspan="2" class="table-header">
227 <table border="0" cellpadding="0" cellspacing="0" width="100%">
229 <td align="left"><span class="table-header">Properties</span></td>
230 <td align="right" valign="top"
231 ><span class="options">[<a href="#section-Properties"
232 class="privatelink" onclick="toggle_private();"
233 >hide private</a>]</span></td>
239 <td colspan="2" class="summary">
240 <p class="indent-wrapped-lines"><b>Inherited from <code><a href="lxml.etree._XPathEvaluatorBase-class.html" onclick="show_private();">_XPathEvaluatorBase</a></code></b>:
241 <code><a href="lxml.etree._XPathEvaluatorBase-class.html#error_log">error_log</a></code>
243 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
244 <code>__class__</code>
249 <!-- ==================== METHOD DETAILS ==================== -->
250 <a name="section-MethodDetails"></a>
251 <table class="details" border="1" cellpadding="3"
252 cellspacing="0" width="100%" bgcolor="white">
253 <tr bgcolor="#70b0f0" class="table-header">
254 <td colspan="2" class="table-header">
255 <table border="0" cellpadding="0" cellspacing="0" width="100%">
257 <td align="left"><span class="table-header">Method Details</span></td>
258 <td align="right" valign="top"
259 ><span class="options">[<a href="#section-MethodDetails"
260 class="privatelink" onclick="toggle_private();"
261 >hide private</a>]</span></td>
267 <a name="__call__"></a>
269 <table class="details" border="1" cellpadding="3"
270 cellspacing="0" width="100%" bgcolor="white">
272 <table width="100%" cellpadding="0" cellspacing="0" border="0">
273 <tr valign="top"><td>
274 <h3 class="epydoc"><span class="sig"><span class="sig-name">__call__</span>(<span class="sig-arg">self</span>,
275 <span class="sig-arg">_path</span>,
276 <span class="sig-arg">**_variables</span>)</span>
277 <br /><em class="fname">(Call operator)</em>
279 </td><td align="right" valign="top"
284 <p>Evaluate an XPath expression on the document.</p>
285 <p>Variables may be provided as keyword arguments. Note that namespaces
286 are currently not supported for variables.</p>
287 <p>Absolute XPath expressions (starting with '/') will be evaluated
288 against the ElementTree as returned by getroottree().</p>
293 <a name="__init__"></a>
295 <table class="details" border="1" cellpadding="3"
296 cellspacing="0" width="100%" bgcolor="white">
298 <table width="100%" cellpadding="0" cellspacing="0" border="0">
299 <tr valign="top"><td>
300 <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
301 <span class="sig-arg">element</span>,
302 <span class="sig-arg">namespaces</span>=<span class="sig-default">None</span>,
303 <span class="sig-arg">extensions</span>=<span class="sig-default">None</span>,
304 <span class="sig-arg">regexp</span>=<span class="sig-default">True</span>,
305 <span class="sig-arg">smart_strings</span>=<span class="sig-default">True</span>)</span>
306 <br /><em class="fname">(Constructor)</em>
308 </td><td align="right" valign="top"
313 x.__init__(...) initializes x; see help(type(x)) for signature
321 <a name="__new__"></a>
323 <table class="details" border="1" cellpadding="3"
324 cellspacing="0" width="100%" bgcolor="white">
326 <table width="100%" cellpadding="0" cellspacing="0" border="0">
327 <tr valign="top"><td>
328 <h3 class="epydoc"><span class="sig"><span class="sig-name">__new__</span>(<span class="sig-arg">T</span>,
329 <span class="sig-arg">S</span>,
330 <span class="sig-arg">...</span>)</span>
332 </td><td align="right" valign="top"
339 <dt>Returns: a new object with type S, a subtype of T</dt>
347 <!-- ==================== NAVIGATION BAR ==================== -->
348 <table class="navbar" border="0" width="100%" cellpadding="0"
349 bgcolor="#a0c0ff" cellspacing="0">
352 <th> <a
353 href="lxml-module.html">Home</a> </th>
356 <th> <a
357 href="module-tree.html">Trees</a> </th>
360 <th> <a
361 href="identifier-index.html">Indices</a> </th>
364 <th> <a
365 href="help.html">Help</a> </th>
367 <!-- Project homepage -->
368 <th class="navbar" align="right" width="100%">
369 <table border="0" cellpadding="0" cellspacing="0">
370 <tr><th class="navbar" align="center"
371 ><a class="navbar" target="_top" href="/">lxml API</a></th>
375 <table border="0" cellpadding="0" cellspacing="0" width="100%%">
377 <td align="left" class="footer">
378 Generated by Epydoc 3.0.1
379 on Wed Jan 29 12:26:21 2020
381 <td align="right" class="footer">
382 <a target="mainFrame" href="http://epydoc.sourceforge.net"
383 >http://epydoc.sourceforge.net</a>
388 <script type="text/javascript">
390 // Private objects are initially displayed (because if
391 // javascript is turned off then we want them to be
392 // visible); but by default, we want to hide them. So hide
393 // them unless we have a cookie that says to show them.