Imported Upstream version 4.5.2
[platform/upstream/python-lxml.git] / doc / html / api / lxml.etree.TreeBuilder-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.TreeBuilder</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;TreeBuilder
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.TreeBuilder-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 TreeBuilder</h1><p class="nomargin-top"></p>
65 <pre class="base-tree">
66       object --+    
67                |    
68 <a href="lxml.etree._SaxParserTarget-class.html" onclick="show_private();">_SaxParserTarget</a> --+
69                    |
70                   <strong class="uidshort">TreeBuilder</strong>
71 </pre>
72
73 <hr />
74 <dl class="rst-docutils">
75 <dt>TreeBuilder(self, element_factory=None, parser=None,</dt>
76 <dd>comment_factory=None, pi_factory=None,
77 insert_comments=True, insert_pis=True)</dd>
78 </dl>
79 <p>Parser target that builds a tree from parse event callbacks.</p>
80 <p>The factory arguments can be used to influence the creation of
81 elements, comments and processing instructions.</p>
82 <p>By default, comments and processing instructions are inserted into
83 the tree, but they can be ignored by passing the respective flags.</p>
84 <p>The final tree is returned by the <tt class="rst-docutils literal">close()</tt> method.</p>
85
86 <!-- ==================== INSTANCE METHODS ==================== -->
87 <a name="section-InstanceMethods"></a>
88 <table class="summary" border="1" cellpadding="3"
89        cellspacing="0" width="100%" bgcolor="white">
90 <tr bgcolor="#70b0f0" class="table-header">
91   <td colspan="2" class="table-header">
92     <table border="0" cellpadding="0" cellspacing="0" width="100%">
93       <tr valign="top">
94         <td align="left"><span class="table-header">Instance Methods</span></td>
95         <td align="right" valign="top"
96          ><span class="options">[<a href="#section-InstanceMethods"
97          class="privatelink" onclick="toggle_private();"
98          >hide private</a>]</span></td>
99       </tr>
100     </table>
101   </td>
102 </tr>
103 <tr>
104     <td width="15%" align="right" valign="top" class="summary">
105       <span class="summary-type">&nbsp;</span>
106     </td><td class="summary">
107       <table width="100%" cellpadding="0" cellspacing="0" border="0">
108         <tr>
109           <td><span class="summary-sig"><a href="lxml.etree.TreeBuilder-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
110         <span class="summary-sig-arg">element_factory</span>=<span class="summary-sig-default">None</span>,
111         <span class="summary-sig-arg">parser</span>=<span class="summary-sig-default">None</span>,
112         <span class="summary-sig-arg">comment_factory</span>=<span class="summary-sig-default">None</span>,
113         <span class="summary-sig-arg">pi_factory</span>=<span class="summary-sig-default">None</span>,
114         <span class="summary-sig-arg">insert_comments</span>=<span class="summary-sig-default">True</span>,
115         <span class="summary-sig-arg">insert_pis</span>=<span class="summary-sig-default">True</span>)</span><br />
116       x.__init__(...) initializes x; see help(type(x)) for signature</td>
117           <td align="right" valign="top">
118             
119             
120           </td>
121         </tr>
122       </table>
123       
124     </td>
125   </tr>
126 <tr>
127     <td width="15%" align="right" valign="top" class="summary">
128       <span class="summary-type">a new object with type S, a subtype of T</span>
129     </td><td class="summary">
130       <table width="100%" cellpadding="0" cellspacing="0" border="0">
131         <tr>
132           <td><span class="summary-sig"><a href="lxml.etree.TreeBuilder-class.html#__new__" class="summary-sig-name">__new__</a>(<span class="summary-sig-arg">T</span>,
133         <span class="summary-sig-arg">S</span>,
134         <span class="summary-sig-arg">...</span>)</span></td>
135           <td align="right" valign="top">
136             
137             
138           </td>
139         </tr>
140       </table>
141       
142     </td>
143   </tr>
144 <tr>
145     <td width="15%" align="right" valign="top" class="summary">
146       <span class="summary-type">&nbsp;</span>
147     </td><td class="summary">
148       <table width="100%" cellpadding="0" cellspacing="0" border="0">
149         <tr>
150           <td><span class="summary-sig"><a name="close"></a><span class="summary-sig-name">close</span>(<span class="summary-sig-arg">self</span>)</span><br />
151       Flushes the builder buffers, and returns the toplevel document
152 element.</td>
153           <td align="right" valign="top">
154             
155             
156           </td>
157         </tr>
158       </table>
159       
160     </td>
161   </tr>
162 <tr>
163     <td width="15%" align="right" valign="top" class="summary">
164       <span class="summary-type">&nbsp;</span>
165     </td><td class="summary">
166       <table width="100%" cellpadding="0" cellspacing="0" border="0">
167         <tr>
168           <td><span class="summary-sig"><a name="comment"></a><span class="summary-sig-name">comment</span>(<span class="summary-sig-arg">self</span>,
169         <span class="summary-sig-arg">comment</span>)</span><br />
170       Creates a comment using the factory, appends it (unless disabled)
171 and returns it.</td>
172           <td align="right" valign="top">
173             
174             
175           </td>
176         </tr>
177       </table>
178       
179     </td>
180   </tr>
181 <tr>
182     <td width="15%" align="right" valign="top" class="summary">
183       <span class="summary-type">&nbsp;</span>
184     </td><td class="summary">
185       <table width="100%" cellpadding="0" cellspacing="0" border="0">
186         <tr>
187           <td><span class="summary-sig"><a name="data"></a><span class="summary-sig-name">data</span>(<span class="summary-sig-arg">self</span>,
188         <span class="summary-sig-arg">data</span>)</span><br />
189       Adds text to the current element.  The value should be either an
190 8-bit string containing ASCII text, or a Unicode string.</td>
191           <td align="right" valign="top">
192             
193             
194           </td>
195         </tr>
196       </table>
197       
198     </td>
199   </tr>
200 <tr>
201     <td width="15%" align="right" valign="top" class="summary">
202       <span class="summary-type">&nbsp;</span>
203     </td><td class="summary">
204       <table width="100%" cellpadding="0" cellspacing="0" border="0">
205         <tr>
206           <td><span class="summary-sig"><a name="end"></a><span class="summary-sig-name">end</span>(<span class="summary-sig-arg">self</span>,
207         <span class="summary-sig-arg">tag</span>)</span><br />
208       Closes the current element.</td>
209           <td align="right" valign="top">
210             
211             
212           </td>
213         </tr>
214       </table>
215       
216     </td>
217   </tr>
218 <tr>
219     <td width="15%" align="right" valign="top" class="summary">
220       <span class="summary-type">&nbsp;</span>
221     </td><td class="summary">
222       <table width="100%" cellpadding="0" cellspacing="0" border="0">
223         <tr>
224           <td><span class="summary-sig"><a name="pi"></a><span class="summary-sig-name">pi</span>(<span class="summary-sig-arg">self</span>,
225         <span class="summary-sig-arg">target</span>,
226         <span class="summary-sig-arg">data</span>=<span class="summary-sig-default">None</span>)</span><br />
227       Creates a processing instruction using the factory, appends it
228 (unless disabled) and returns it.</td>
229           <td align="right" valign="top">
230             
231             
232           </td>
233         </tr>
234       </table>
235       
236     </td>
237   </tr>
238 <tr>
239     <td width="15%" align="right" valign="top" class="summary">
240       <span class="summary-type">&nbsp;</span>
241     </td><td class="summary">
242       <table width="100%" cellpadding="0" cellspacing="0" border="0">
243         <tr>
244           <td><span class="summary-sig"><a name="start"></a><span class="summary-sig-name">start</span>(<span class="summary-sig-arg">self</span>,
245         <span class="summary-sig-arg">tag</span>,
246         <span class="summary-sig-arg">attrs</span>,
247         <span class="summary-sig-arg">nsmap</span>=<span class="summary-sig-default">None</span>)</span><br />
248       Opens a new element.</td>
249           <td align="right" valign="top">
250             
251             
252           </td>
253         </tr>
254       </table>
255       
256     </td>
257   </tr>
258   <tr>
259     <td colspan="2" class="summary">
260     <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
261       <code>__delattr__</code>,
262       <code>__format__</code>,
263       <code>__getattribute__</code>,
264       <code>__hash__</code>,
265       <code>__reduce__</code>,
266       <code>__reduce_ex__</code>,
267       <code>__repr__</code>,
268       <code>__setattr__</code>,
269       <code>__sizeof__</code>,
270       <code>__str__</code>,
271       <code>__subclasshook__</code>
272       </p>
273     </td>
274   </tr>
275 </table>
276 <!-- ==================== PROPERTIES ==================== -->
277 <a name="section-Properties"></a>
278 <table class="summary" border="1" cellpadding="3"
279        cellspacing="0" width="100%" bgcolor="white">
280 <tr bgcolor="#70b0f0" class="table-header">
281   <td colspan="2" class="table-header">
282     <table border="0" cellpadding="0" cellspacing="0" width="100%">
283       <tr valign="top">
284         <td align="left"><span class="table-header">Properties</span></td>
285         <td align="right" valign="top"
286          ><span class="options">[<a href="#section-Properties"
287          class="privatelink" onclick="toggle_private();"
288          >hide private</a>]</span></td>
289       </tr>
290     </table>
291   </td>
292 </tr>
293   <tr>
294     <td colspan="2" class="summary">
295     <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
296       <code>__class__</code>
297       </p>
298     </td>
299   </tr>
300 </table>
301 <!-- ==================== METHOD DETAILS ==================== -->
302 <a name="section-MethodDetails"></a>
303 <table class="details" border="1" cellpadding="3"
304        cellspacing="0" width="100%" bgcolor="white">
305 <tr bgcolor="#70b0f0" class="table-header">
306   <td colspan="2" class="table-header">
307     <table border="0" cellpadding="0" cellspacing="0" width="100%">
308       <tr valign="top">
309         <td align="left"><span class="table-header">Method Details</span></td>
310         <td align="right" valign="top"
311          ><span class="options">[<a href="#section-MethodDetails"
312          class="privatelink" onclick="toggle_private();"
313          >hide private</a>]</span></td>
314       </tr>
315     </table>
316   </td>
317 </tr>
318 </table>
319 <a name="__init__"></a>
320 <div>
321 <table class="details" border="1" cellpadding="3"
322        cellspacing="0" width="100%" bgcolor="white">
323 <tr><td>
324   <table width="100%" cellpadding="0" cellspacing="0" border="0">
325   <tr valign="top"><td>
326   <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
327         <span class="sig-arg">element_factory</span>=<span class="sig-default">None</span>,
328         <span class="sig-arg">parser</span>=<span class="sig-default">None</span>,
329         <span class="sig-arg">comment_factory</span>=<span class="sig-default">None</span>,
330         <span class="sig-arg">pi_factory</span>=<span class="sig-default">None</span>,
331         <span class="sig-arg">insert_comments</span>=<span class="sig-default">True</span>,
332         <span class="sig-arg">insert_pis</span>=<span class="sig-default">True</span>)</span>
333     <br /><em class="fname">(Constructor)</em>
334   </h3>
335   </td><td align="right" valign="top"
336     >&nbsp;
337     </td>
338   </tr></table>
339   
340   x.__init__(...) initializes x; see help(type(x)) for signature
341   <dl class="fields">
342     <dt>Overrides:
343         object.__init__
344     </dt>
345   </dl>
346 </td></tr></table>
347 </div>
348 <a name="__new__"></a>
349 <div>
350 <table class="details" border="1" cellpadding="3"
351        cellspacing="0" width="100%" bgcolor="white">
352 <tr><td>
353   <table width="100%" cellpadding="0" cellspacing="0" border="0">
354   <tr valign="top"><td>
355   <h3 class="epydoc"><span class="sig"><span class="sig-name">__new__</span>(<span class="sig-arg">T</span>,
356         <span class="sig-arg">S</span>,
357         <span class="sig-arg">...</span>)</span>
358   </h3>
359   </td><td align="right" valign="top"
360     >&nbsp;
361     </td>
362   </tr></table>
363   
364   
365   <dl class="fields">
366     <dt>Returns: a new object with type S, a subtype of T</dt>
367     <dt>Overrides:
368         object.__new__
369     </dt>
370   </dl>
371 </td></tr></table>
372 </div>
373 <br />
374 <!-- ==================== NAVIGATION BAR ==================== -->
375 <table class="navbar" border="0" width="100%" cellpadding="0"
376        bgcolor="#a0c0ff" cellspacing="0">
377   <tr valign="middle">
378   <!-- Home link -->
379       <th>&nbsp;&nbsp;&nbsp;<a
380         href="lxml-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
381
382   <!-- Tree link -->
383       <th>&nbsp;&nbsp;&nbsp;<a
384         href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
385
386   <!-- Index link -->
387       <th>&nbsp;&nbsp;&nbsp;<a
388         href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
389
390   <!-- Help link -->
391       <th>&nbsp;&nbsp;&nbsp;<a
392         href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
393
394   <!-- Project homepage -->
395       <th class="navbar" align="right" width="100%">
396         <table border="0" cellpadding="0" cellspacing="0">
397           <tr><th class="navbar" align="center"
398             ><a class="navbar" target="_top" href="/">lxml API</a></th>
399           </tr></table></th>
400   </tr>
401 </table>
402 <table border="0" cellpadding="0" cellspacing="0" width="100%%">
403   <tr>
404     <td align="left" class="footer">
405     Generated by Epydoc 3.0.1
406     on Thu Jul  9 18:29:53 2020
407     </td>
408     <td align="right" class="footer">
409       <a target="mainFrame" href="http://epydoc.sourceforge.net"
410         >http://epydoc.sourceforge.net</a>
411     </td>
412   </tr>
413 </table>
414
415 <script type="text/javascript">
416   <!--
417   // Private objects are initially displayed (because if
418   // javascript is turned off then we want them to be
419   // visible); but by default, we want to hide them.  So hide
420   // them unless we have a cookie that says to show them.
421   checkCookie();
422   // -->
423 </script>
424 </body>
425 </html>