08cd67ab6996f41f135577f59aa1bd59736dbb35
[platform/upstream/python-lxml.git] / doc / html / api / lxml.etree.ElementDepthFirstIterator-class.html
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">
5 <head>
6   <title>lxml.etree.ElementDepthFirstIterator</title>
7   <link rel="stylesheet" href="epydoc.css" type="text/css" />
8   <script type="text/javascript" src="epydoc.js"></script>
9 </head>
10
11 <body bgcolor="white" text="black" link="blue" vlink="#204080"
12       alink="#204080">
13 <!-- ==================== NAVIGATION BAR ==================== -->
14 <table class="navbar" border="0" width="100%" cellpadding="0"
15        bgcolor="#a0c0ff" cellspacing="0">
16   <tr valign="middle">
17   <!-- Home link -->
18       <th>&nbsp;&nbsp;&nbsp;<a
19         href="lxml-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
20
21   <!-- Tree link -->
22       <th>&nbsp;&nbsp;&nbsp;<a
23         href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
24
25   <!-- Index link -->
26       <th>&nbsp;&nbsp;&nbsp;<a
27         href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
28
29   <!-- Help link -->
30       <th>&nbsp;&nbsp;&nbsp;<a
31         href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
32
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>
38           </tr></table></th>
39   </tr>
40 </table>
41 <table width="100%" cellpadding="0" cellspacing="0">
42   <tr valign="top">
43     <td width="100%">
44       <span class="breadcrumbs">
45         <a href="lxml-module.html">Package&nbsp;lxml</a> ::
46         <a href="lxml.etree-module.html">Module&nbsp;etree</a> ::
47         Class&nbsp;ElementDepthFirstIterator
48       </span>
49     </td>
50     <td>
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&nbsp;private</a>]</span></td></tr>
55         <tr><td align="right"><span class="options"
56             >[<a href="frames.html" target="_top">frames</a
57             >]&nbsp;|&nbsp;<a href="lxml.etree.ElementDepthFirstIterator-class.html"
58             target="_top">no&nbsp;frames</a>]</span></td></tr>
59       </table>
60     </td>
61   </tr>
62 </table>
63 <!-- ==================== CLASS DESCRIPTION ==================== -->
64 <h1 class="epydoc">Class ElementDepthFirstIterator</h1><p class="nomargin-top"></p>
65 <pre class="base-tree">
66 object --+
67          |
68         <strong class="uidshort">ElementDepthFirstIterator</strong>
69 </pre>
70
71 <hr />
72 <p>ElementDepthFirstIterator(self, node, tag=None, inclusive=True)
73 Iterates over an element and its sub-elements in document order (depth
74 first pre-order).</p>
75 <p>Note that this also includes comments, entities and processing
76 instructions.  To filter them out, check if the <tt class="rst-docutils literal">tag</tt> property
77 of the returned element is a string (i.e. not None and not a
78 factory function), or pass the <tt class="rst-docutils literal">Element</tt> factory for the <tt class="rst-docutils literal">tag</tt>
79 argument to receive only Elements.</p>
80 <p>If the optional <tt class="rst-docutils literal">tag</tt> argument is not None, the iterator returns only
81 the elements that match the respective name and namespace.</p>
82 <p>The optional boolean argument 'inclusive' defaults to True and can be set
83 to False to exclude the start element itself.</p>
84 <p>Note that the behaviour of this iterator is completely undefined if the
85 tree it traverses is modified during iteration.</p>
86
87 <!-- ==================== INSTANCE METHODS ==================== -->
88 <a name="section-InstanceMethods"></a>
89 <table class="summary" border="1" cellpadding="3"
90        cellspacing="0" width="100%" bgcolor="white">
91 <tr bgcolor="#70b0f0" class="table-header">
92   <td colspan="2" class="table-header">
93     <table border="0" cellpadding="0" cellspacing="0" width="100%">
94       <tr valign="top">
95         <td align="left"><span class="table-header">Instance Methods</span></td>
96         <td align="right" valign="top"
97          ><span class="options">[<a href="#section-InstanceMethods"
98          class="privatelink" onclick="toggle_private();"
99          >hide private</a>]</span></td>
100       </tr>
101     </table>
102   </td>
103 </tr>
104 <tr>
105     <td width="15%" align="right" valign="top" class="summary">
106       <span class="summary-type">&nbsp;</span>
107     </td><td class="summary">
108       <table width="100%" cellpadding="0" cellspacing="0" border="0">
109         <tr>
110           <td><span class="summary-sig"><a name="__iter__"></a><span class="summary-sig-name">__iter__</span>(<span class="summary-sig-arg">x</span>)</span><br />
111       iter(x)</td>
112           <td align="right" valign="top">
113             
114             
115           </td>
116         </tr>
117       </table>
118       
119     </td>
120   </tr>
121 <tr>
122     <td width="15%" align="right" valign="top" class="summary">
123       <span class="summary-type">a new object with type S, a subtype of T</span>
124     </td><td class="summary">
125       <table width="100%" cellpadding="0" cellspacing="0" border="0">
126         <tr>
127           <td><span class="summary-sig"><a href="lxml.etree.ElementDepthFirstIterator-class.html#__new__" class="summary-sig-name">__new__</a>(<span class="summary-sig-arg">T</span>,
128         <span class="summary-sig-arg">S</span>,
129         <span class="summary-sig-arg">...</span>)</span></td>
130           <td align="right" valign="top">
131             
132             
133           </td>
134         </tr>
135       </table>
136       
137     </td>
138   </tr>
139 <tr>
140     <td width="15%" align="right" valign="top" class="summary">
141       <span class="summary-type">&nbsp;</span>
142     </td><td class="summary">
143       <table width="100%" cellpadding="0" cellspacing="0" border="0">
144         <tr>
145           <td><span class="summary-sig"><a name="__next__"></a><span class="summary-sig-name">__next__</span>(<span class="summary-sig-arg">...</span>)</span></td>
146           <td align="right" valign="top">
147             
148             
149           </td>
150         </tr>
151       </table>
152       
153     </td>
154   </tr>
155 <tr>
156     <td width="15%" align="right" valign="top" class="summary">
157       <span class="summary-type">the next value, or raise StopIteration</span>
158     </td><td class="summary">
159       <table width="100%" cellpadding="0" cellspacing="0" border="0">
160         <tr>
161           <td><span class="summary-sig"><a name="next"></a><span class="summary-sig-name">next</span>(<span class="summary-sig-arg">x</span>)</span></td>
162           <td align="right" valign="top">
163             
164             
165           </td>
166         </tr>
167       </table>
168       
169     </td>
170   </tr>
171   <tr>
172     <td colspan="2" class="summary">
173     <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
174       <code>__delattr__</code>,
175       <code>__format__</code>,
176       <code>__getattribute__</code>,
177       <code>__hash__</code>,
178       <code>__init__</code>,
179       <code>__reduce__</code>,
180       <code>__reduce_ex__</code>,
181       <code>__repr__</code>,
182       <code>__setattr__</code>,
183       <code>__sizeof__</code>,
184       <code>__str__</code>,
185       <code>__subclasshook__</code>
186       </p>
187     </td>
188   </tr>
189 </table>
190 <!-- ==================== PROPERTIES ==================== -->
191 <a name="section-Properties"></a>
192 <table class="summary" border="1" cellpadding="3"
193        cellspacing="0" width="100%" bgcolor="white">
194 <tr bgcolor="#70b0f0" class="table-header">
195   <td colspan="2" class="table-header">
196     <table border="0" cellpadding="0" cellspacing="0" width="100%">
197       <tr valign="top">
198         <td align="left"><span class="table-header">Properties</span></td>
199         <td align="right" valign="top"
200          ><span class="options">[<a href="#section-Properties"
201          class="privatelink" onclick="toggle_private();"
202          >hide private</a>]</span></td>
203       </tr>
204     </table>
205   </td>
206 </tr>
207   <tr>
208     <td colspan="2" class="summary">
209     <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
210       <code>__class__</code>
211       </p>
212     </td>
213   </tr>
214 </table>
215 <!-- ==================== METHOD DETAILS ==================== -->
216 <a name="section-MethodDetails"></a>
217 <table class="details" border="1" cellpadding="3"
218        cellspacing="0" width="100%" bgcolor="white">
219 <tr bgcolor="#70b0f0" class="table-header">
220   <td colspan="2" class="table-header">
221     <table border="0" cellpadding="0" cellspacing="0" width="100%">
222       <tr valign="top">
223         <td align="left"><span class="table-header">Method Details</span></td>
224         <td align="right" valign="top"
225          ><span class="options">[<a href="#section-MethodDetails"
226          class="privatelink" onclick="toggle_private();"
227          >hide private</a>]</span></td>
228       </tr>
229     </table>
230   </td>
231 </tr>
232 </table>
233 <a name="__new__"></a>
234 <div>
235 <table class="details" border="1" cellpadding="3"
236        cellspacing="0" width="100%" bgcolor="white">
237 <tr><td>
238   <table width="100%" cellpadding="0" cellspacing="0" border="0">
239   <tr valign="top"><td>
240   <h3 class="epydoc"><span class="sig"><span class="sig-name">__new__</span>(<span class="sig-arg">T</span>,
241         <span class="sig-arg">S</span>,
242         <span class="sig-arg">...</span>)</span>
243   </h3>
244   </td><td align="right" valign="top"
245     >&nbsp;
246     </td>
247   </tr></table>
248   
249   
250   <dl class="fields">
251     <dt>Returns: a new object with type S, a subtype of T</dt>
252     <dt>Overrides:
253         object.__new__
254     </dt>
255   </dl>
256 </td></tr></table>
257 </div>
258 <br />
259 <!-- ==================== NAVIGATION BAR ==================== -->
260 <table class="navbar" border="0" width="100%" cellpadding="0"
261        bgcolor="#a0c0ff" cellspacing="0">
262   <tr valign="middle">
263   <!-- Home link -->
264       <th>&nbsp;&nbsp;&nbsp;<a
265         href="lxml-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
266
267   <!-- Tree link -->
268       <th>&nbsp;&nbsp;&nbsp;<a
269         href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
270
271   <!-- Index link -->
272       <th>&nbsp;&nbsp;&nbsp;<a
273         href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
274
275   <!-- Help link -->
276       <th>&nbsp;&nbsp;&nbsp;<a
277         href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
278
279   <!-- Project homepage -->
280       <th class="navbar" align="right" width="100%">
281         <table border="0" cellpadding="0" cellspacing="0">
282           <tr><th class="navbar" align="center"
283             ><a class="navbar" target="_top" href="/">lxml API</a></th>
284           </tr></table></th>
285   </tr>
286 </table>
287 <table border="0" cellpadding="0" cellspacing="0" width="100%%">
288   <tr>
289     <td align="left" class="footer">
290     Generated by Epydoc 3.0.1
291     on Wed Jan 29 12:26:21 2020
292     </td>
293     <td align="right" class="footer">
294       <a target="mainFrame" href="http://epydoc.sourceforge.net"
295         >http://epydoc.sourceforge.net</a>
296     </td>
297   </tr>
298 </table>
299
300 <script type="text/javascript">
301   <!--
302   // Private objects are initially displayed (because if
303   // javascript is turned off then we want them to be
304   // visible); but by default, we want to hide them.  So hide
305   // them unless we have a cookie that says to show them.
306   checkCookie();
307   // -->
308 </script>
309 </body>
310 </html>