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._Element</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> ::
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._Element-class.html"
58 target="_top">no frames</a>]</span></td></tr>
63 <!-- ==================== CLASS DESCRIPTION ==================== -->
64 <h1 class="epydoc">Class _Element</h1><p class="nomargin-top"></p>
65 <pre class="base-tree">
68 <strong class="uidshort">_Element</strong>
71 <dl><dt>Known Subclasses:</dt>
73 <ul class="subclass-list">
74 <li><a href="lxml.etree.ElementBase-class.html">ElementBase</a></li><li>, <i>unreachable</i>.__ContentOnlyElement</li> </ul>
79 <p>References a document object and a libxml node.</p>
80 <p>By pointing to a Document instance, a reference is kept to
81 _Document as long as there is some pointer to a node in it.</p>
83 <!-- ==================== INSTANCE METHODS ==================== -->
84 <a name="section-InstanceMethods"></a>
85 <table class="summary" border="1" cellpadding="3"
86 cellspacing="0" width="100%" bgcolor="white">
87 <tr bgcolor="#70b0f0" class="table-header">
88 <td colspan="2" class="table-header">
89 <table border="0" cellpadding="0" cellspacing="0" width="100%">
91 <td align="left"><span class="table-header">Instance Methods</span></td>
92 <td align="right" valign="top"
93 ><span class="options">[<a href="#section-InstanceMethods"
94 class="privatelink" onclick="toggle_private();"
95 >hide private</a>]</span></td>
101 <td width="15%" align="right" valign="top" class="summary">
102 <span class="summary-type"> </span>
103 </td><td class="summary">
104 <table width="100%" cellpadding="0" cellspacing="0" border="0">
106 <td><span class="summary-sig"><a name="__contains__"></a><span class="summary-sig-name">__contains__</span>(<span class="summary-sig-arg">self</span>,
107 <span class="summary-sig-arg">element</span>)</span></td>
108 <td align="right" valign="top">
118 <td width="15%" align="right" valign="top" class="summary">
119 <span class="summary-type"> </span>
120 </td><td class="summary">
121 <table width="100%" cellpadding="0" cellspacing="0" border="0">
123 <td><span class="summary-sig"><a name="__copy__"></a><span class="summary-sig-name">__copy__</span>(<span class="summary-sig-arg">self</span>)</span></td>
124 <td align="right" valign="top">
134 <td width="15%" align="right" valign="top" class="summary">
135 <span class="summary-type"> </span>
136 </td><td class="summary">
137 <table width="100%" cellpadding="0" cellspacing="0" border="0">
139 <td><span class="summary-sig"><a name="__deepcopy__"></a><span class="summary-sig-name">__deepcopy__</span>(<span class="summary-sig-arg">self</span>,
140 <span class="summary-sig-arg">memo</span>)</span></td>
141 <td align="right" valign="top">
151 <td width="15%" align="right" valign="top" class="summary">
152 <span class="summary-type"> </span>
153 </td><td class="summary">
154 <table width="100%" cellpadding="0" cellspacing="0" border="0">
156 <td><span class="summary-sig"><a name="__delitem__"></a><span class="summary-sig-name">__delitem__</span>(<span class="summary-sig-arg">self</span>,
157 <span class="summary-sig-arg">x</span>)</span><br />
158 Deletes the given subelement or a slice.</td>
159 <td align="right" valign="top">
169 <td width="15%" align="right" valign="top" class="summary">
170 <span class="summary-type"> </span>
171 </td><td class="summary">
172 <table width="100%" cellpadding="0" cellspacing="0" border="0">
174 <td><span class="summary-sig"><a name="__getitem__"></a><span class="summary-sig-name">__getitem__</span>(<span class="summary-sig-arg">...</span>)</span><br />
175 Returns the subelement at the given position or the requested
177 <td align="right" valign="top">
187 <td width="15%" align="right" valign="top" class="summary">
188 <span class="summary-type"> </span>
189 </td><td class="summary">
190 <table width="100%" cellpadding="0" cellspacing="0" border="0">
192 <td><span class="summary-sig"><a name="__iter__"></a><span class="summary-sig-name">__iter__</span>(<span class="summary-sig-arg">self</span>)</span></td>
193 <td align="right" valign="top">
203 <td width="15%" align="right" valign="top" class="summary">
204 <span class="summary-type"> </span>
205 </td><td class="summary">
206 <table width="100%" cellpadding="0" cellspacing="0" border="0">
208 <td><span class="summary-sig"><a name="__len__"></a><span class="summary-sig-name">__len__</span>(<span class="summary-sig-arg">self</span>)</span><br />
209 Returns the number of subelements.</td>
210 <td align="right" valign="top">
220 <td width="15%" align="right" valign="top" class="summary">
221 <span class="summary-type">a new object with type S, a subtype of T</span>
222 </td><td class="summary">
223 <table width="100%" cellpadding="0" cellspacing="0" border="0">
225 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#__new__" class="summary-sig-name">__new__</a>(<span class="summary-sig-arg">T</span>,
226 <span class="summary-sig-arg">S</span>,
227 <span class="summary-sig-arg">...</span>)</span></td>
228 <td align="right" valign="top">
238 <td width="15%" align="right" valign="top" class="summary">
239 <span class="summary-type"> </span>
240 </td><td class="summary">
241 <table width="100%" cellpadding="0" cellspacing="0" border="0">
243 <td><span class="summary-sig"><a name="__nonzero__"></a><span class="summary-sig-name">__nonzero__</span>(<span class="summary-sig-arg">x</span>)</span><br />
245 <td align="right" valign="top">
255 <td width="15%" align="right" valign="top" class="summary">
256 <span class="summary-type"> </span>
257 </td><td class="summary">
258 <table width="100%" cellpadding="0" cellspacing="0" border="0">
260 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#__repr__" class="summary-sig-name">__repr__</a>(<span class="summary-sig-arg">self</span>)</span><br />
262 <td align="right" valign="top">
272 <td width="15%" align="right" valign="top" class="summary">
273 <span class="summary-type"> </span>
274 </td><td class="summary">
275 <table width="100%" cellpadding="0" cellspacing="0" border="0">
277 <td><span class="summary-sig"><a name="__reversed__"></a><span class="summary-sig-name">__reversed__</span>(<span class="summary-sig-arg">self</span>)</span></td>
278 <td align="right" valign="top">
288 <td width="15%" align="right" valign="top" class="summary">
289 <span class="summary-type"> </span>
290 </td><td class="summary">
291 <table width="100%" cellpadding="0" cellspacing="0" border="0">
293 <td><span class="summary-sig"><a name="__setitem__"></a><span class="summary-sig-name">__setitem__</span>(<span class="summary-sig-arg">self</span>,
294 <span class="summary-sig-arg">x</span>,
295 <span class="summary-sig-arg">value</span>)</span><br />
296 Replaces the given subelement index or slice.</td>
297 <td align="right" valign="top">
307 <td width="15%" align="right" valign="top" class="summary">
308 <span class="summary-type"> </span>
309 </td><td class="summary">
310 <table width="100%" cellpadding="0" cellspacing="0" border="0">
312 <td><span class="summary-sig"><a name="_init"></a><span class="summary-sig-name">_init</span>(<span class="summary-sig-arg">self</span>)</span><br />
313 Called after object initialisation. Custom subclasses may override
314 this if they recursively call _init() in the superclasses.</td>
315 <td align="right" valign="top">
325 <td width="15%" align="right" valign="top" class="summary">
326 <span class="summary-type"> </span>
327 </td><td class="summary">
328 <table width="100%" cellpadding="0" cellspacing="0" border="0">
330 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#addnext" class="summary-sig-name">addnext</a>(<span class="summary-sig-arg">self</span>,
331 <span class="summary-sig-arg">element</span>)</span><br />
332 Adds the element as a following sibling directly after this
334 <td align="right" valign="top">
344 <td width="15%" align="right" valign="top" class="summary">
345 <span class="summary-type"> </span>
346 </td><td class="summary">
347 <table width="100%" cellpadding="0" cellspacing="0" border="0">
349 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#addprevious" class="summary-sig-name">addprevious</a>(<span class="summary-sig-arg">self</span>,
350 <span class="summary-sig-arg">element</span>)</span><br />
351 Adds the element as a preceding sibling directly before this
353 <td align="right" valign="top">
363 <td width="15%" align="right" valign="top" class="summary">
364 <span class="summary-type"> </span>
365 </td><td class="summary">
366 <table width="100%" cellpadding="0" cellspacing="0" border="0">
368 <td><span class="summary-sig"><a name="append"></a><span class="summary-sig-name">append</span>(<span class="summary-sig-arg">self</span>,
369 <span class="summary-sig-arg">element</span>)</span><br />
370 Adds a subelement to the end of this element.</td>
371 <td align="right" valign="top">
381 <td width="15%" align="right" valign="top" class="summary">
382 <span class="summary-type"> </span>
383 </td><td class="summary">
384 <table width="100%" cellpadding="0" cellspacing="0" border="0">
386 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#clear" class="summary-sig-name">clear</a>(<span class="summary-sig-arg">self</span>,
387 <span class="summary-sig-arg">keep_tail</span>=<span class="summary-sig-default">False</span>)</span><br />
388 Resets an element. This function removes all subelements, clears
389 all attributes and sets the text and tail properties to None.</td>
390 <td align="right" valign="top">
400 <td width="15%" align="right" valign="top" class="summary">
401 <span class="summary-type"> </span>
402 </td><td class="summary">
403 <table width="100%" cellpadding="0" cellspacing="0" border="0">
405 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#cssselect" class="summary-sig-name">cssselect</a>(<span class="summary-sig-arg">...</span>)</span><br />
406 Run the CSS expression on this element and its children,
407 returning a list of the results.</td>
408 <td align="right" valign="top">
418 <td width="15%" align="right" valign="top" class="summary">
419 <span class="summary-type"> </span>
420 </td><td class="summary">
421 <table width="100%" cellpadding="0" cellspacing="0" border="0">
423 <td><span class="summary-sig"><a name="extend"></a><span class="summary-sig-name">extend</span>(<span class="summary-sig-arg">self</span>,
424 <span class="summary-sig-arg">elements</span>)</span><br />
425 Extends the current children by the elements in the iterable.</td>
426 <td align="right" valign="top">
436 <td width="15%" align="right" valign="top" class="summary">
437 <span class="summary-type"> </span>
438 </td><td class="summary">
439 <table width="100%" cellpadding="0" cellspacing="0" border="0">
441 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#find" class="summary-sig-name">find</a>(<span class="summary-sig-arg">self</span>,
442 <span class="summary-sig-arg">path</span>,
443 <span class="summary-sig-arg">namespaces</span>=<span class="summary-sig-default">None</span>)</span><br />
444 Finds the first matching subelement, by tag name or path.</td>
445 <td align="right" valign="top">
455 <td width="15%" align="right" valign="top" class="summary">
456 <span class="summary-type"> </span>
457 </td><td class="summary">
458 <table width="100%" cellpadding="0" cellspacing="0" border="0">
460 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#findall" class="summary-sig-name">findall</a>(<span class="summary-sig-arg">self</span>,
461 <span class="summary-sig-arg">path</span>,
462 <span class="summary-sig-arg">namespaces</span>=<span class="summary-sig-default">None</span>)</span><br />
463 Finds all matching subelements, by tag name or path.</td>
464 <td align="right" valign="top">
474 <td width="15%" align="right" valign="top" class="summary">
475 <span class="summary-type"> </span>
476 </td><td class="summary">
477 <table width="100%" cellpadding="0" cellspacing="0" border="0">
479 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#findtext" class="summary-sig-name">findtext</a>(<span class="summary-sig-arg">self</span>,
480 <span class="summary-sig-arg">path</span>,
481 <span class="summary-sig-arg">default</span>=<span class="summary-sig-default">None</span>,
482 <span class="summary-sig-arg">namespaces</span>=<span class="summary-sig-default">None</span>)</span><br />
483 Finds text for the first matching subelement, by tag name or path.</td>
484 <td align="right" valign="top">
494 <td width="15%" align="right" valign="top" class="summary">
495 <span class="summary-type"> </span>
496 </td><td class="summary">
497 <table width="100%" cellpadding="0" cellspacing="0" border="0">
499 <td><span class="summary-sig"><a name="get"></a><span class="summary-sig-name">get</span>(<span class="summary-sig-arg">self</span>,
500 <span class="summary-sig-arg">key</span>,
501 <span class="summary-sig-arg">default</span>=<span class="summary-sig-default">None</span>)</span><br />
502 Gets an element attribute.</td>
503 <td align="right" valign="top">
513 <td width="15%" align="right" valign="top" class="summary">
514 <span class="summary-type"> </span>
515 </td><td class="summary">
516 <table width="100%" cellpadding="0" cellspacing="0" border="0">
518 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#getchildren" class="summary-sig-name">getchildren</a>(<span class="summary-sig-arg">self</span>)</span><br />
519 Returns all direct children. The elements are returned in document
521 <td align="right" valign="top">
531 <td width="15%" align="right" valign="top" class="summary">
532 <span class="summary-type"> </span>
533 </td><td class="summary">
534 <table width="100%" cellpadding="0" cellspacing="0" border="0">
536 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#getiterator" class="summary-sig-name">getiterator</a>(<span class="summary-sig-arg">self</span>,
537 <span class="summary-sig-arg">tag</span>=<span class="summary-sig-default">None</span>,
538 <span class="summary-sig-arg">*tags</span>)</span><br />
539 Returns a sequence or iterator of all elements in the subtree in
540 document order (depth first pre-order), starting with this
542 <td align="right" valign="top">
552 <td width="15%" align="right" valign="top" class="summary">
553 <span class="summary-type"> </span>
554 </td><td class="summary">
555 <table width="100%" cellpadding="0" cellspacing="0" border="0">
557 <td><span class="summary-sig"><a name="getnext"></a><span class="summary-sig-name">getnext</span>(<span class="summary-sig-arg">self</span>)</span><br />
558 Returns the following sibling of this element or None.</td>
559 <td align="right" valign="top">
569 <td width="15%" align="right" valign="top" class="summary">
570 <span class="summary-type"> </span>
571 </td><td class="summary">
572 <table width="100%" cellpadding="0" cellspacing="0" border="0">
574 <td><span class="summary-sig"><a name="getparent"></a><span class="summary-sig-name">getparent</span>(<span class="summary-sig-arg">self</span>)</span><br />
575 Returns the parent of this element or None for the root element.</td>
576 <td align="right" valign="top">
586 <td width="15%" align="right" valign="top" class="summary">
587 <span class="summary-type"> </span>
588 </td><td class="summary">
589 <table width="100%" cellpadding="0" cellspacing="0" border="0">
591 <td><span class="summary-sig"><a name="getprevious"></a><span class="summary-sig-name">getprevious</span>(<span class="summary-sig-arg">self</span>)</span><br />
592 Returns the preceding sibling of this element or None.</td>
593 <td align="right" valign="top">
603 <td width="15%" align="right" valign="top" class="summary">
604 <span class="summary-type"> </span>
605 </td><td class="summary">
606 <table width="100%" cellpadding="0" cellspacing="0" border="0">
608 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#getroottree" class="summary-sig-name">getroottree</a>(<span class="summary-sig-arg">self</span>)</span><br />
609 Return an ElementTree for the root node of the document that
610 contains this element.</td>
611 <td align="right" valign="top">
621 <td width="15%" align="right" valign="top" class="summary">
622 <span class="summary-type"> </span>
623 </td><td class="summary">
624 <table width="100%" cellpadding="0" cellspacing="0" border="0">
626 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#index" class="summary-sig-name">index</a>(<span class="summary-sig-arg">self</span>,
627 <span class="summary-sig-arg">child</span>,
628 <span class="summary-sig-arg">start</span>=<span class="summary-sig-default">None</span>,
629 <span class="summary-sig-arg">stop</span>=<span class="summary-sig-default">None</span>)</span><br />
630 Find the position of the child within the parent.</td>
631 <td align="right" valign="top">
641 <td width="15%" align="right" valign="top" class="summary">
642 <span class="summary-type"> </span>
643 </td><td class="summary">
644 <table width="100%" cellpadding="0" cellspacing="0" border="0">
646 <td><span class="summary-sig"><a name="insert"></a><span class="summary-sig-name">insert</span>(<span class="summary-sig-arg">self</span>,
647 <span class="summary-sig-arg">index</span>,
648 <span class="summary-sig-arg">element</span>)</span><br />
649 Inserts a subelement at the given position in this element</td>
650 <td align="right" valign="top">
660 <td width="15%" align="right" valign="top" class="summary">
661 <span class="summary-type"> </span>
662 </td><td class="summary">
663 <table width="100%" cellpadding="0" cellspacing="0" border="0">
665 <td><span class="summary-sig"><a name="items"></a><span class="summary-sig-name">items</span>(<span class="summary-sig-arg">self</span>)</span><br />
666 Gets element attributes, as a sequence. The attributes are returned in
667 an arbitrary order.</td>
668 <td align="right" valign="top">
678 <td width="15%" align="right" valign="top" class="summary">
679 <span class="summary-type"> </span>
680 </td><td class="summary">
681 <table width="100%" cellpadding="0" cellspacing="0" border="0">
683 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#iter" class="summary-sig-name">iter</a>(<span class="summary-sig-arg">self</span>,
684 <span class="summary-sig-arg">tag</span>=<span class="summary-sig-default">None</span>,
685 <span class="summary-sig-arg">*tags</span>)</span><br />
686 Iterate over all elements in the subtree in document order (depth
687 first pre-order), starting with this element.</td>
688 <td align="right" valign="top">
698 <td width="15%" align="right" valign="top" class="summary">
699 <span class="summary-type"> </span>
700 </td><td class="summary">
701 <table width="100%" cellpadding="0" cellspacing="0" border="0">
703 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#iterancestors" class="summary-sig-name">iterancestors</a>(<span class="summary-sig-arg">self</span>,
704 <span class="summary-sig-arg">tag</span>=<span class="summary-sig-default">None</span>,
705 <span class="summary-sig-arg">*tags</span>)</span><br />
706 Iterate over the ancestors of this element (from parent to parent).</td>
707 <td align="right" valign="top">
717 <td width="15%" align="right" valign="top" class="summary">
718 <span class="summary-type"> </span>
719 </td><td class="summary">
720 <table width="100%" cellpadding="0" cellspacing="0" border="0">
722 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#iterchildren" class="summary-sig-name">iterchildren</a>(<span class="summary-sig-arg">self</span>,
723 <span class="summary-sig-arg">tag</span>=<span class="summary-sig-default">None</span>,
724 <span class="summary-sig-arg">reversed</span>=<span class="summary-sig-default">False</span>,
725 <span class="summary-sig-arg">*tags</span>)</span><br />
726 Iterate over the children of this element.</td>
727 <td align="right" valign="top">
737 <td width="15%" align="right" valign="top" class="summary">
738 <span class="summary-type"> </span>
739 </td><td class="summary">
740 <table width="100%" cellpadding="0" cellspacing="0" border="0">
742 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#iterdescendants" class="summary-sig-name">iterdescendants</a>(<span class="summary-sig-arg">self</span>,
743 <span class="summary-sig-arg">tag</span>=<span class="summary-sig-default">None</span>,
744 <span class="summary-sig-arg">*tags</span>)</span><br />
745 Iterate over the descendants of this element in document order.</td>
746 <td align="right" valign="top">
756 <td width="15%" align="right" valign="top" class="summary">
757 <span class="summary-type"> </span>
758 </td><td class="summary">
759 <table width="100%" cellpadding="0" cellspacing="0" border="0">
761 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#iterfind" class="summary-sig-name">iterfind</a>(<span class="summary-sig-arg">self</span>,
762 <span class="summary-sig-arg">path</span>,
763 <span class="summary-sig-arg">namespaces</span>=<span class="summary-sig-default">None</span>)</span><br />
764 Iterates over all matching subelements, by tag name or path.</td>
765 <td align="right" valign="top">
775 <td width="15%" align="right" valign="top" class="summary">
776 <span class="summary-type"> </span>
777 </td><td class="summary">
778 <table width="100%" cellpadding="0" cellspacing="0" border="0">
780 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#itersiblings" class="summary-sig-name">itersiblings</a>(<span class="summary-sig-arg">self</span>,
781 <span class="summary-sig-arg">tag</span>=<span class="summary-sig-default">None</span>,
782 <span class="summary-sig-arg">preceding</span>=<span class="summary-sig-default">False</span>,
783 <span class="summary-sig-arg">*tags</span>)</span><br />
784 Iterate over the following or preceding siblings of this element.</td>
785 <td align="right" valign="top">
795 <td width="15%" align="right" valign="top" class="summary">
796 <span class="summary-type"> </span>
797 </td><td class="summary">
798 <table width="100%" cellpadding="0" cellspacing="0" border="0">
800 <td><span class="summary-sig"><a href="lxml.etree._Element-class.html#itertext" class="summary-sig-name">itertext</a>(<span class="summary-sig-arg">self</span>,
801 <span class="summary-sig-arg">tag</span>=<span class="summary-sig-default">None</span>,
802 <span class="summary-sig-arg">with_tail</span>=<span class="summary-sig-default">True</span>,
803 <span class="summary-sig-arg">*tags</span>)</span><br />
804 Iterates over the text content of a subtree.</td>
805 <td align="right" valign="top">
815 <td width="15%" align="right" valign="top" class="summary">
816 <span class="summary-type"> </span>
817 </td><td class="summary">
818 <table width="100%" cellpadding="0" cellspacing="0" border="0">
820 <td><span class="summary-sig"><a name="keys"></a><span class="summary-sig-name">keys</span>(<span class="summary-sig-arg">self</span>)</span><br />
821 Gets a list of attribute names. The names are returned in an
822 arbitrary order (just like for an ordinary Python dictionary).</td>
823 <td align="right" valign="top">
833 <td width="15%" align="right" valign="top" class="summary">
834 <span class="summary-type"> </span>
835 </td><td class="summary">
836 <table width="100%" cellpadding="0" cellspacing="0" border="0">
838 <td><span class="summary-sig"><a name="makeelement"></a><span class="summary-sig-name">makeelement</span>(<span class="summary-sig-arg">self</span>,
839 <span class="summary-sig-arg">_tag</span>,
840 <span class="summary-sig-arg">attrib</span>=<span class="summary-sig-default">None</span>,
841 <span class="summary-sig-arg">nsmap</span>=<span class="summary-sig-default">None</span>,
842 <span class="summary-sig-arg">**_extra</span>)</span><br />
843 Creates a new element associated with the same document.</td>
844 <td align="right" valign="top">
854 <td width="15%" align="right" valign="top" class="summary">
855 <span class="summary-type"> </span>
856 </td><td class="summary">
857 <table width="100%" cellpadding="0" cellspacing="0" border="0">
859 <td><span class="summary-sig"><a name="remove"></a><span class="summary-sig-name">remove</span>(<span class="summary-sig-arg">self</span>,
860 <span class="summary-sig-arg">element</span>)</span><br />
861 Removes a matching subelement. Unlike the find methods, this
862 method compares elements based on identity, not on tag value
864 <td align="right" valign="top">
874 <td width="15%" align="right" valign="top" class="summary">
875 <span class="summary-type"> </span>
876 </td><td class="summary">
877 <table width="100%" cellpadding="0" cellspacing="0" border="0">
879 <td><span class="summary-sig"><a name="replace"></a><span class="summary-sig-name">replace</span>(<span class="summary-sig-arg">self</span>,
880 <span class="summary-sig-arg">old_element</span>,
881 <span class="summary-sig-arg">new_element</span>)</span><br />
882 Replaces a subelement with the element passed as second argument.</td>
883 <td align="right" valign="top">
893 <td width="15%" align="right" valign="top" class="summary">
894 <span class="summary-type"> </span>
895 </td><td class="summary">
896 <table width="100%" cellpadding="0" cellspacing="0" border="0">
898 <td><span class="summary-sig"><a name="set"></a><span class="summary-sig-name">set</span>(<span class="summary-sig-arg">self</span>,
899 <span class="summary-sig-arg">key</span>,
900 <span class="summary-sig-arg">value</span>)</span><br />
901 Sets an element attribute.</td>
902 <td align="right" valign="top">
912 <td width="15%" align="right" valign="top" class="summary">
913 <span class="summary-type"> </span>
914 </td><td class="summary">
915 <table width="100%" cellpadding="0" cellspacing="0" border="0">
917 <td><span class="summary-sig"><a name="values"></a><span class="summary-sig-name">values</span>(<span class="summary-sig-arg">self</span>)</span><br />
918 Gets element attribute values as a sequence of strings. The
919 attributes are returned in an arbitrary order.</td>
920 <td align="right" valign="top">
930 <td width="15%" align="right" valign="top" class="summary">
931 <span class="summary-type"> </span>
932 </td><td class="summary">
933 <table width="100%" cellpadding="0" cellspacing="0" border="0">
935 <td><span class="summary-sig"><a name="xpath"></a><span class="summary-sig-name">xpath</span>(<span class="summary-sig-arg">self</span>,
936 <span class="summary-sig-arg">_path</span>,
937 <span class="summary-sig-arg">namespaces</span>=<span class="summary-sig-default">None</span>,
938 <span class="summary-sig-arg">extensions</span>=<span class="summary-sig-default">None</span>,
939 <span class="summary-sig-arg">smart_strings</span>=<span class="summary-sig-default">True</span>,
940 <span class="summary-sig-arg">**_variables</span>)</span><br />
941 Evaluate an xpath expression using the element as context node.</td>
942 <td align="right" valign="top">
952 <td colspan="2" class="summary">
953 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
954 <code>__delattr__</code>,
955 <code>__format__</code>,
956 <code>__getattribute__</code>,
957 <code>__hash__</code>,
958 <code>__init__</code>,
959 <code>__reduce__</code>,
960 <code>__reduce_ex__</code>,
961 <code>__setattr__</code>,
962 <code>__sizeof__</code>,
963 <code>__str__</code>,
964 <code>__subclasshook__</code>
969 <!-- ==================== PROPERTIES ==================== -->
970 <a name="section-Properties"></a>
971 <table class="summary" border="1" cellpadding="3"
972 cellspacing="0" width="100%" bgcolor="white">
973 <tr bgcolor="#70b0f0" class="table-header">
974 <td colspan="2" class="table-header">
975 <table border="0" cellpadding="0" cellspacing="0" width="100%">
977 <td align="left"><span class="table-header">Properties</span></td>
978 <td align="right" valign="top"
979 ><span class="options">[<a href="#section-Properties"
980 class="privatelink" onclick="toggle_private();"
981 >hide private</a>]</span></td>
987 <td width="15%" align="right" valign="top" class="summary">
988 <span class="summary-type"> </span>
989 </td><td class="summary">
990 <a name="attrib"></a><span class="summary-name">attrib</span><br />
991 Element attribute dictionary. Where possible, use get(), set(),
992 keys(), values() and items() to access element attributes.
996 <td width="15%" align="right" valign="top" class="summary">
997 <span class="summary-type"> </span>
998 </td><td class="summary">
999 <a href="lxml.etree._Element-class.html#base" class="summary-name">base</a><br />
1000 The base URI of the Element (xml:base or HTML base URL).
1001 None if the base URI is unknown.
1005 <td width="15%" align="right" valign="top" class="summary">
1006 <span class="summary-type"> </span>
1007 </td><td class="summary">
1008 <a href="lxml.etree._Element-class.html#nsmap" class="summary-name">nsmap</a><br />
1009 Namespace prefix->URI mapping known in the context of this
1010 Element. This includes all namespace declarations of the
1015 <td width="15%" align="right" valign="top" class="summary">
1016 <span class="summary-type"> </span>
1017 </td><td class="summary">
1018 <a name="prefix"></a><span class="summary-name">prefix</span><br />
1019 Namespace prefix or None.
1023 <td width="15%" align="right" valign="top" class="summary">
1024 <span class="summary-type"> </span>
1025 </td><td class="summary">
1026 <a name="sourceline"></a><span class="summary-name">sourceline</span><br />
1027 Original line number as found by the parser or None if unknown.
1031 <td width="15%" align="right" valign="top" class="summary">
1032 <span class="summary-type"> </span>
1033 </td><td class="summary">
1034 <a name="tag"></a><span class="summary-name">tag</span><br />
1039 <td width="15%" align="right" valign="top" class="summary">
1040 <span class="summary-type"> </span>
1041 </td><td class="summary">
1042 <a name="tail"></a><span class="summary-name">tail</span><br />
1043 Text after this element's end tag, but before the next sibling
1044 element's start tag. This is either a string or the value None, if
1049 <td width="15%" align="right" valign="top" class="summary">
1050 <span class="summary-type"> </span>
1051 </td><td class="summary">
1052 <a name="text"></a><span class="summary-name">text</span><br />
1053 Text before the first subelement. This is either a string or
1054 the value None, if there was no text.
1058 <td colspan="2" class="summary">
1059 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
1060 <code>__class__</code>
1065 <!-- ==================== METHOD DETAILS ==================== -->
1066 <a name="section-MethodDetails"></a>
1067 <table class="details" border="1" cellpadding="3"
1068 cellspacing="0" width="100%" bgcolor="white">
1069 <tr bgcolor="#70b0f0" class="table-header">
1070 <td colspan="2" class="table-header">
1071 <table border="0" cellpadding="0" cellspacing="0" width="100%">
1073 <td align="left"><span class="table-header">Method Details</span></td>
1074 <td align="right" valign="top"
1075 ><span class="options">[<a href="#section-MethodDetails"
1076 class="privatelink" onclick="toggle_private();"
1077 >hide private</a>]</span></td>
1083 <a name="__new__"></a>
1085 <table class="details" border="1" cellpadding="3"
1086 cellspacing="0" width="100%" bgcolor="white">
1088 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1089 <tr valign="top"><td>
1090 <h3 class="epydoc"><span class="sig"><span class="sig-name">__new__</span>(<span class="sig-arg">T</span>,
1091 <span class="sig-arg">S</span>,
1092 <span class="sig-arg">...</span>)</span>
1094 </td><td align="right" valign="top"
1101 <dt>Returns: a new object with type S, a subtype of T</dt>
1108 <a name="__repr__"></a>
1110 <table class="details" border="1" cellpadding="3"
1111 cellspacing="0" width="100%" bgcolor="white">
1113 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1114 <tr valign="top"><td>
1115 <h3 class="epydoc"><span class="sig"><span class="sig-name">__repr__</span>(<span class="sig-arg">self</span>)</span>
1116 <br /><em class="fname">(Representation operator)</em>
1118 </td><td align="right" valign="top"
1131 <a name="addnext"></a>
1133 <table class="details" border="1" cellpadding="3"
1134 cellspacing="0" width="100%" bgcolor="white">
1136 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1137 <tr valign="top"><td>
1138 <h3 class="epydoc"><span class="sig"><span class="sig-name">addnext</span>(<span class="sig-arg">self</span>,
1139 <span class="sig-arg">element</span>)</span>
1141 </td><td align="right" valign="top"
1146 <p>Adds the element as a following sibling directly after this
1148 <p>This is normally used to set a processing instruction or comment after
1149 the root node of a document. Note that tail text is automatically
1150 discarded when adding at the root level.</p>
1155 <a name="addprevious"></a>
1157 <table class="details" border="1" cellpadding="3"
1158 cellspacing="0" width="100%" bgcolor="white">
1160 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1161 <tr valign="top"><td>
1162 <h3 class="epydoc"><span class="sig"><span class="sig-name">addprevious</span>(<span class="sig-arg">self</span>,
1163 <span class="sig-arg">element</span>)</span>
1165 </td><td align="right" valign="top"
1170 <p>Adds the element as a preceding sibling directly before this
1172 <p>This is normally used to set a processing instruction or comment
1173 before the root node of a document. Note that tail text is
1174 automatically discarded when adding at the root level.</p>
1179 <a name="clear"></a>
1181 <table class="details" border="1" cellpadding="3"
1182 cellspacing="0" width="100%" bgcolor="white">
1184 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1185 <tr valign="top"><td>
1186 <h3 class="epydoc"><span class="sig"><span class="sig-name">clear</span>(<span class="sig-arg">self</span>,
1187 <span class="sig-arg">keep_tail</span>=<span class="sig-default">False</span>)</span>
1189 </td><td align="right" valign="top"
1194 <p>Resets an element. This function removes all subelements, clears
1195 all attributes and sets the text and tail properties to None.</p>
1196 <p>Pass <tt class="rst-docutils literal">keep_tail=True</tt> to leave the tail text untouched.</p>
1201 <a name="cssselect"></a>
1203 <table class="details" border="1" cellpadding="3"
1204 cellspacing="0" width="100%" bgcolor="white">
1206 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1207 <tr valign="top"><td>
1208 <h3 class="epydoc"><span class="sig"><span class="sig-name">cssselect</span>(<span class="sig-arg">...</span>)</span>
1210 </td><td align="right" valign="top"
1215 <p>Run the CSS expression on this element and its children,
1216 returning a list of the results.</p>
1217 <p>Equivalent to lxml.cssselect.CSSSelect(expr)(self) -- note
1218 that pre-compiling the expression can provide a substantial
1226 <table class="details" border="1" cellpadding="3"
1227 cellspacing="0" width="100%" bgcolor="white">
1229 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1230 <tr valign="top"><td>
1231 <h3 class="epydoc"><span class="sig"><span class="sig-name">find</span>(<span class="sig-arg">self</span>,
1232 <span class="sig-arg">path</span>,
1233 <span class="sig-arg">namespaces</span>=<span class="sig-default">None</span>)</span>
1235 </td><td align="right" valign="top"
1240 <p>Finds the first matching subelement, by tag name or path.</p>
1241 <p>The optional <tt class="rst-docutils literal">namespaces</tt> argument accepts a
1242 prefix-to-namespace mapping that allows the usage of XPath
1243 prefixes in the path expression.</p>
1248 <a name="findall"></a>
1250 <table class="details" border="1" cellpadding="3"
1251 cellspacing="0" width="100%" bgcolor="white">
1253 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1254 <tr valign="top"><td>
1255 <h3 class="epydoc"><span class="sig"><span class="sig-name">findall</span>(<span class="sig-arg">self</span>,
1256 <span class="sig-arg">path</span>,
1257 <span class="sig-arg">namespaces</span>=<span class="sig-default">None</span>)</span>
1259 </td><td align="right" valign="top"
1264 <p>Finds all matching subelements, by tag name or path.</p>
1265 <p>The optional <tt class="rst-docutils literal">namespaces</tt> argument accepts a
1266 prefix-to-namespace mapping that allows the usage of XPath
1267 prefixes in the path expression.</p>
1272 <a name="findtext"></a>
1274 <table class="details" border="1" cellpadding="3"
1275 cellspacing="0" width="100%" bgcolor="white">
1277 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1278 <tr valign="top"><td>
1279 <h3 class="epydoc"><span class="sig"><span class="sig-name">findtext</span>(<span class="sig-arg">self</span>,
1280 <span class="sig-arg">path</span>,
1281 <span class="sig-arg">default</span>=<span class="sig-default">None</span>,
1282 <span class="sig-arg">namespaces</span>=<span class="sig-default">None</span>)</span>
1284 </td><td align="right" valign="top"
1289 <p>Finds text for the first matching subelement, by tag name or path.</p>
1290 <p>The optional <tt class="rst-docutils literal">namespaces</tt> argument accepts a
1291 prefix-to-namespace mapping that allows the usage of XPath
1292 prefixes in the path expression.</p>
1297 <a name="getchildren"></a>
1299 <table class="details" border="1" cellpadding="3"
1300 cellspacing="0" width="100%" bgcolor="white">
1302 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1303 <tr valign="top"><td>
1304 <h3 class="epydoc"><span class="sig"><span class="sig-name">getchildren</span>(<span class="sig-arg">self</span>)</span>
1306 </td><td align="right" valign="top"
1311 Returns all direct children. The elements are returned in document
1315 <div class="fields"> <p><strong>Deprecated:</strong>
1316 Note that this method has been deprecated as of
1317 ElementTree 1.3 and lxml 2.0. New code should use
1318 <tt class="rst-docutils literal">list(element)</tt> or simply iterate over elements.
1320 </div></td></tr></table>
1322 <a name="getiterator"></a>
1324 <table class="details" border="1" cellpadding="3"
1325 cellspacing="0" width="100%" bgcolor="white">
1327 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1328 <tr valign="top"><td>
1329 <h3 class="epydoc"><span class="sig"><span class="sig-name">getiterator</span>(<span class="sig-arg">self</span>,
1330 <span class="sig-arg">tag</span>=<span class="sig-default">None</span>,
1331 <span class="sig-arg">*tags</span>)</span>
1333 </td><td align="right" valign="top"
1338 <p>Returns a sequence or iterator of all elements in the subtree in
1339 document order (depth first pre-order), starting with this
1341 <p>Can be restricted to find only elements with specific tags,
1342 see <a href="lxml.etree._Element-class.html#iter" class="link">iter</a>.</p>
1345 <div class="fields"> <p><strong>Deprecated:</strong>
1346 Note that this method is deprecated as of
1347 ElementTree 1.3 and lxml 2.0. It returns an iterator in
1348 lxml, which diverges from the original ElementTree
1349 behaviour. If you want an efficient iterator, use the
1350 <tt class="rst-docutils literal">element.iter()</tt> method instead. You should only use this
1351 method in new code if you require backwards compatibility
1352 with older versions of lxml or ElementTree.
1354 </div></td></tr></table>
1356 <a name="getroottree"></a>
1358 <table class="details" border="1" cellpadding="3"
1359 cellspacing="0" width="100%" bgcolor="white">
1361 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1362 <tr valign="top"><td>
1363 <h3 class="epydoc"><span class="sig"><span class="sig-name">getroottree</span>(<span class="sig-arg">self</span>)</span>
1365 </td><td align="right" valign="top"
1370 <p>Return an ElementTree for the root node of the document that
1371 contains this element.</p>
1372 <p>This is the same as following element.getparent() up the tree until it
1373 returns None (for the root element) and then build an ElementTree for
1374 the last parent that was returned.</p>
1379 <a name="index"></a>
1381 <table class="details" border="1" cellpadding="3"
1382 cellspacing="0" width="100%" bgcolor="white">
1384 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1385 <tr valign="top"><td>
1386 <h3 class="epydoc"><span class="sig"><span class="sig-name">index</span>(<span class="sig-arg">self</span>,
1387 <span class="sig-arg">child</span>,
1388 <span class="sig-arg">start</span>=<span class="sig-default">None</span>,
1389 <span class="sig-arg">stop</span>=<span class="sig-default">None</span>)</span>
1391 </td><td align="right" valign="top"
1396 <p>Find the position of the child within the parent.</p>
1397 <p>This method is not part of the original ElementTree API.</p>
1404 <table class="details" border="1" cellpadding="3"
1405 cellspacing="0" width="100%" bgcolor="white">
1407 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1408 <tr valign="top"><td>
1409 <h3 class="epydoc"><span class="sig"><span class="sig-name">iter</span>(<span class="sig-arg">self</span>,
1410 <span class="sig-arg">tag</span>=<span class="sig-default">None</span>,
1411 <span class="sig-arg">*tags</span>)</span>
1413 </td><td align="right" valign="top"
1418 <p>Iterate over all elements in the subtree in document order (depth
1419 first pre-order), starting with this element.</p>
1420 <p>Can be restricted to find only elements with specific tags:
1421 pass <tt class="rst-docutils literal">"{ns}localname"</tt> as tag. Either or both of <tt class="rst-docutils literal">ns</tt> and
1422 <tt class="rst-docutils literal">localname</tt> can be <tt class="rst-docutils literal">*</tt> for a wildcard; <tt class="rst-docutils literal">ns</tt> can be empty
1423 for no namespace. <tt class="rst-docutils literal">"localname"</tt> is equivalent to <tt class="rst-docutils literal"><span class="pre">"{}localname"</span></tt>
1424 (i.e. no namespace) but <tt class="rst-docutils literal">"*"</tt> is <tt class="rst-docutils literal"><span class="pre">"{*}*"</span></tt> (any or no namespace),
1425 not <tt class="rst-docutils literal"><span class="pre">"{}*"</span></tt>.</p>
1426 <p>You can also pass the Element, Comment, ProcessingInstruction and
1427 Entity factory functions to look only for the specific element type.</p>
1428 <p>Passing multiple tags (or a sequence of tags) instead of a single tag
1429 will let the iterator return all elements matching any of these tags,
1430 in document order.</p>
1435 <a name="iterancestors"></a>
1437 <table class="details" border="1" cellpadding="3"
1438 cellspacing="0" width="100%" bgcolor="white">
1440 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1441 <tr valign="top"><td>
1442 <h3 class="epydoc"><span class="sig"><span class="sig-name">iterancestors</span>(<span class="sig-arg">self</span>,
1443 <span class="sig-arg">tag</span>=<span class="sig-default">None</span>,
1444 <span class="sig-arg">*tags</span>)</span>
1446 </td><td align="right" valign="top"
1451 <p>Iterate over the ancestors of this element (from parent to parent).</p>
1452 <p>Can be restricted to find only elements with specific tags,
1453 see <a href="lxml.etree._Element-class.html#iter" class="link">iter</a>.</p>
1458 <a name="iterchildren"></a>
1460 <table class="details" border="1" cellpadding="3"
1461 cellspacing="0" width="100%" bgcolor="white">
1463 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1464 <tr valign="top"><td>
1465 <h3 class="epydoc"><span class="sig"><span class="sig-name">iterchildren</span>(<span class="sig-arg">self</span>,
1466 <span class="sig-arg">tag</span>=<span class="sig-default">None</span>,
1467 <span class="sig-arg">reversed</span>=<span class="sig-default">False</span>,
1468 <span class="sig-arg">*tags</span>)</span>
1470 </td><td align="right" valign="top"
1475 <p>Iterate over the children of this element.</p>
1476 <p>As opposed to using normal iteration on this element, the returned
1477 elements can be reversed with the 'reversed' keyword and restricted
1478 to find only elements with specific tags, see <a href="lxml.etree._Element-class.html#iter" class="link">iter</a>.</p>
1483 <a name="iterdescendants"></a>
1485 <table class="details" border="1" cellpadding="3"
1486 cellspacing="0" width="100%" bgcolor="white">
1488 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1489 <tr valign="top"><td>
1490 <h3 class="epydoc"><span class="sig"><span class="sig-name">iterdescendants</span>(<span class="sig-arg">self</span>,
1491 <span class="sig-arg">tag</span>=<span class="sig-default">None</span>,
1492 <span class="sig-arg">*tags</span>)</span>
1494 </td><td align="right" valign="top"
1499 <p>Iterate over the descendants of this element in document order.</p>
1500 <p>As opposed to <tt class="rst-docutils literal">el.iter()</tt>, this iterator does not yield the element
1501 itself. The returned elements can be restricted to find only elements
1502 with specific tags, see <a href="lxml.etree._Element-class.html#iter" class="link">iter</a>.</p>
1507 <a name="iterfind"></a>
1509 <table class="details" border="1" cellpadding="3"
1510 cellspacing="0" width="100%" bgcolor="white">
1512 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1513 <tr valign="top"><td>
1514 <h3 class="epydoc"><span class="sig"><span class="sig-name">iterfind</span>(<span class="sig-arg">self</span>,
1515 <span class="sig-arg">path</span>,
1516 <span class="sig-arg">namespaces</span>=<span class="sig-default">None</span>)</span>
1518 </td><td align="right" valign="top"
1523 <p>Iterates over all matching subelements, by tag name or path.</p>
1524 <p>The optional <tt class="rst-docutils literal">namespaces</tt> argument accepts a
1525 prefix-to-namespace mapping that allows the usage of XPath
1526 prefixes in the path expression.</p>
1531 <a name="itersiblings"></a>
1533 <table class="details" border="1" cellpadding="3"
1534 cellspacing="0" width="100%" bgcolor="white">
1536 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1537 <tr valign="top"><td>
1538 <h3 class="epydoc"><span class="sig"><span class="sig-name">itersiblings</span>(<span class="sig-arg">self</span>,
1539 <span class="sig-arg">tag</span>=<span class="sig-default">None</span>,
1540 <span class="sig-arg">preceding</span>=<span class="sig-default">False</span>,
1541 <span class="sig-arg">*tags</span>)</span>
1543 </td><td align="right" valign="top"
1548 <p>Iterate over the following or preceding siblings of this element.</p>
1549 <p>The direction is determined by the 'preceding' keyword which
1550 defaults to False, i.e. forward iteration over the following
1551 siblings. When True, the iterator yields the preceding
1552 siblings in reverse document order, i.e. starting right before
1553 the current element and going backwards.</p>
1554 <p>Can be restricted to find only elements with specific tags,
1555 see <a href="lxml.etree._Element-class.html#iter" class="link">iter</a>.</p>
1560 <a name="itertext"></a>
1562 <table class="details" border="1" cellpadding="3"
1563 cellspacing="0" width="100%" bgcolor="white">
1565 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1566 <tr valign="top"><td>
1567 <h3 class="epydoc"><span class="sig"><span class="sig-name">itertext</span>(<span class="sig-arg">self</span>,
1568 <span class="sig-arg">tag</span>=<span class="sig-default">None</span>,
1569 <span class="sig-arg">with_tail</span>=<span class="sig-default">True</span>,
1570 <span class="sig-arg">*tags</span>)</span>
1572 </td><td align="right" valign="top"
1577 <p>Iterates over the text content of a subtree.</p>
1578 <p>You can pass tag names to restrict text content to specific elements,
1579 see <a href="lxml.etree._Element-class.html#iter" class="link">iter</a>.</p>
1580 <p>You can set the <tt class="rst-docutils literal">with_tail</tt> keyword argument to <tt class="rst-docutils literal">False</tt> to skip
1587 <!-- ==================== PROPERTY DETAILS ==================== -->
1588 <a name="section-PropertyDetails"></a>
1589 <table class="details" border="1" cellpadding="3"
1590 cellspacing="0" width="100%" bgcolor="white">
1591 <tr bgcolor="#70b0f0" class="table-header">
1592 <td colspan="2" class="table-header">
1593 <table border="0" cellpadding="0" cellspacing="0" width="100%">
1595 <td align="left"><span class="table-header">Property Details</span></td>
1596 <td align="right" valign="top"
1597 ><span class="options">[<a href="#section-PropertyDetails"
1598 class="privatelink" onclick="toggle_private();"
1599 >hide private</a>]</span></td>
1607 <table class="details" border="1" cellpadding="3"
1608 cellspacing="0" width="100%" bgcolor="white">
1610 <h3 class="epydoc">base</h3>
1611 <p>The base URI of the Element (xml:base or HTML base URL).
1612 None if the base URI is unknown.</p>
1613 <p>Note that the value depends on the URL of the document that
1614 holds the Element if there is no xml:base attribute on the
1615 Element or its ancestors.</p>
1616 <p>Setting this property will set an xml:base attribute on the
1617 Element, regardless of the document type (XML or HTML).</p>
1622 <a name="nsmap"></a>
1624 <table class="details" border="1" cellpadding="3"
1625 cellspacing="0" width="100%" bgcolor="white">
1627 <h3 class="epydoc">nsmap</h3>
1628 <p>Namespace prefix->URI mapping known in the context of this
1629 Element. This includes all namespace declarations of the
1631 <p>Note that changing the returned dict has no effect on the Element.</p>
1637 <!-- ==================== NAVIGATION BAR ==================== -->
1638 <table class="navbar" border="0" width="100%" cellpadding="0"
1639 bgcolor="#a0c0ff" cellspacing="0">
1640 <tr valign="middle">
1642 <th> <a
1643 href="lxml-module.html">Home</a> </th>
1646 <th> <a
1647 href="module-tree.html">Trees</a> </th>
1650 <th> <a
1651 href="identifier-index.html">Indices</a> </th>
1654 <th> <a
1655 href="help.html">Help</a> </th>
1657 <!-- Project homepage -->
1658 <th class="navbar" align="right" width="100%">
1659 <table border="0" cellpadding="0" cellspacing="0">
1660 <tr><th class="navbar" align="center"
1661 ><a class="navbar" target="_top" href="/">lxml API</a></th>
1665 <table border="0" cellpadding="0" cellspacing="0" width="100%%">
1667 <td align="left" class="footer">
1668 Generated by Epydoc 3.0.1
1669 on Wed Jan 29 12:26:21 2020
1671 <td align="right" class="footer">
1672 <a target="mainFrame" href="http://epydoc.sourceforge.net"
1673 >http://epydoc.sourceforge.net</a>
1678 <script type="text/javascript">
1680 // Private objects are initially displayed (because if
1681 // javascript is turned off then we want them to be
1682 // visible); but by default, we want to hide them. So hide
1683 // them unless we have a cookie that says to show them.