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</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> ::
50 <table cellpadding="0" cellspacing="0">
51 <!-- hide/show private -->
52 <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
53 onclick="toggle_private();">hide private</a>]</span></td></tr>
54 <tr><td align="right"><span class="options"
55 >[<a href="frames.html" target="_top">frames</a
56 >] | <a href="lxml.etree-module.html"
57 target="_top">no frames</a>]</span></td></tr>
62 <!-- ==================== MODULE DESCRIPTION ==================== -->
63 <h1 class="epydoc">Module etree</h1><p class="nomargin-top"></p>
64 The <tt class="rst-rst-rst-docutils literal rst-rst-docutils literal rst-docutils literal">lxml.etree</tt> module implements the extended ElementTree API
68 <div class="fields"> <p><strong>Version:</strong>
71 </div><!-- ==================== CLASSES ==================== -->
72 <a name="section-Classes"></a>
73 <table class="summary" border="1" cellpadding="3"
74 cellspacing="0" width="100%" bgcolor="white">
75 <tr bgcolor="#70b0f0" class="table-header">
76 <td colspan="2" class="table-header">
77 <table border="0" cellpadding="0" cellspacing="0" width="100%">
79 <td align="left"><span class="table-header">Classes</span></td>
80 <td align="right" valign="top"
81 ><span class="options">[<a href="#section-Classes"
82 class="privatelink" onclick="toggle_private();"
83 >hide private</a>]</span></td>
89 <td width="15%" align="right" valign="top" class="summary">
90 <span class="summary-type"> </span>
91 </td><td class="summary">
92 <a href="lxml.etree.AncestorsIterator-class.html" class="summary-name" onclick="show_private();">AncestorsIterator</a><br />
93 AncestorsIterator(self, node, tag=None)
94 Iterates over the ancestors of an element (from parent to parent).
98 <td width="15%" align="right" valign="top" class="summary">
99 <span class="summary-type"> </span>
100 </td><td class="summary">
101 <a href="lxml.etree.AttributeBasedElementClassLookup-class.html" class="summary-name">AttributeBasedElementClassLookup</a><br />
102 AttributeBasedElementClassLookup(self, attribute_name, class_mapping, fallback=None)
103 Checks an attribute of an Element and looks up the value in a
108 <td width="15%" align="right" valign="top" class="summary">
109 <span class="summary-type"> </span>
110 </td><td class="summary">
111 <a href="lxml.etree.C14NError-class.html" class="summary-name">C14NError</a><br />
112 Error during C14N serialisation.
116 <td width="15%" align="right" valign="top" class="summary">
117 <span class="summary-type"> </span>
118 </td><td class="summary">
119 <a href="lxml.etree.CDATA-class.html" class="summary-name">CDATA</a><br />
124 <td width="15%" align="right" valign="top" class="summary">
125 <span class="summary-type"> </span>
126 </td><td class="summary">
127 <a href="lxml.etree.CommentBase-class.html" class="summary-name">CommentBase</a><br />
128 All custom Comment classes must inherit from this one.
132 <td width="15%" align="right" valign="top" class="summary">
133 <span class="summary-type"> </span>
134 </td><td class="summary">
135 <a href="lxml.etree.CustomElementClassLookup-class.html" class="summary-name">CustomElementClassLookup</a><br />
136 CustomElementClassLookup(self, fallback=None)
137 Element class lookup based on a subclass method.
141 <td width="15%" align="right" valign="top" class="summary">
142 <span class="summary-type"> </span>
143 </td><td class="summary">
144 <a href="lxml.etree.DTD-class.html" class="summary-name">DTD</a><br />
145 DTD(self, file=None, external_id=None)
150 <td width="15%" align="right" valign="top" class="summary">
151 <span class="summary-type"> </span>
152 </td><td class="summary">
153 <a href="lxml.etree.DTDError-class.html" class="summary-name">DTDError</a><br />
154 Base class for DTD errors.
158 <td width="15%" align="right" valign="top" class="summary">
159 <span class="summary-type"> </span>
160 </td><td class="summary">
161 <a href="lxml.etree.DTDParseError-class.html" class="summary-name">DTDParseError</a><br />
162 Error while parsing a DTD.
166 <td width="15%" align="right" valign="top" class="summary">
167 <span class="summary-type"> </span>
168 </td><td class="summary">
169 <a href="lxml.etree.DTDValidateError-class.html" class="summary-name">DTDValidateError</a><br />
170 Error while validating an XML document with a DTD.
174 <td width="15%" align="right" valign="top" class="summary">
175 <span class="summary-type"> </span>
176 </td><td class="summary">
177 <a href="lxml.etree.DocInfo-class.html" class="summary-name" onclick="show_private();">DocInfo</a><br />
178 Document information provided by parser and DTD.
182 <td width="15%" align="right" valign="top" class="summary">
183 <span class="summary-type"> </span>
184 </td><td class="summary">
185 <a href="lxml.etree.DocumentInvalid-class.html" class="summary-name">DocumentInvalid</a><br />
190 <td width="15%" align="right" valign="top" class="summary">
191 <span class="summary-type"> </span>
192 </td><td class="summary">
193 <a href="lxml.etree.ETCompatXMLParser-class.html" class="summary-name">ETCompatXMLParser</a><br />
194 ETCompatXMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, ns_clean=False, recover=False, schema=None, huge_tree=False, remove_blank_text=False, resolve_entities=True, remove_comments=True, remove_pis=True, strip_cdata=True, target=None, compact=True)
198 <td width="15%" align="right" valign="top" class="summary">
199 <span class="summary-type"> </span>
200 </td><td class="summary">
201 <a href="lxml.etree.ETXPath-class.html" class="summary-name">ETXPath</a><br />
202 ETXPath(self, path, extensions=None, regexp=True, smart_strings=True)
203 Special XPath class that supports the ElementTree {uri} notation for namespaces.
207 <td width="15%" align="right" valign="top" class="summary">
208 <span class="summary-type"> </span>
209 </td><td class="summary">
210 <a href="lxml.etree.ElementBase-class.html" class="summary-name">ElementBase</a><br />
211 ElementBase(<a href="#id1"><span class="rst-rst-problematic rst-problematic" id="rst-rst-id2">*</span></a>children, attrib=None, nsmap=None, <a href="#id3"><span class="rst-rst-problematic rst-problematic" id="rst-rst-id4">**</span></a>_extra)
215 <td width="15%" align="right" valign="top" class="summary">
216 <span class="summary-type"> </span>
217 </td><td class="summary">
218 <a href="lxml.etree.ElementChildIterator-class.html" class="summary-name" onclick="show_private();">ElementChildIterator</a><br />
219 ElementChildIterator(self, node, tag=None, reversed=False)
220 Iterates over the children of an element.
224 <td width="15%" align="right" valign="top" class="summary">
225 <span class="summary-type"> </span>
226 </td><td class="summary">
227 <a href="lxml.etree.ElementClassLookup-class.html" class="summary-name">ElementClassLookup</a><br />
228 ElementClassLookup(self)
229 Superclass of Element class lookups.
233 <td width="15%" align="right" valign="top" class="summary">
234 <span class="summary-type"> </span>
235 </td><td class="summary">
236 <a href="lxml.etree.ElementDefaultClassLookup-class.html" class="summary-name">ElementDefaultClassLookup</a><br />
237 ElementDefaultClassLookup(self, element=None, comment=None, pi=None, entity=None)
238 Element class lookup scheme that always returns the default Element
243 <td width="15%" align="right" valign="top" class="summary">
244 <span class="summary-type"> </span>
245 </td><td class="summary">
246 <a href="lxml.etree.ElementDepthFirstIterator-class.html" class="summary-name" onclick="show_private();">ElementDepthFirstIterator</a><br />
247 ElementDepthFirstIterator(self, node, tag=None, inclusive=True)
248 Iterates over an element and its sub-elements in document order (depth
253 <td width="15%" align="right" valign="top" class="summary">
254 <span class="summary-type"> </span>
255 </td><td class="summary">
256 <a href="lxml.etree.ElementNamespaceClassLookup-class.html" class="summary-name">ElementNamespaceClassLookup</a><br />
257 ElementNamespaceClassLookup(self, fallback=None)
261 <td width="15%" align="right" valign="top" class="summary">
262 <span class="summary-type"> </span>
263 </td><td class="summary">
264 <a href="lxml.etree.ElementTextIterator-class.html" class="summary-name" onclick="show_private();">ElementTextIterator</a><br />
265 ElementTextIterator(self, element, tag=None, with_tail=True)
266 Iterates over the text content of a subtree.
270 <td width="15%" align="right" valign="top" class="summary">
271 <span class="summary-type"> </span>
272 </td><td class="summary">
273 <a href="lxml.etree.EntityBase-class.html" class="summary-name">EntityBase</a><br />
274 All custom Entity classes must inherit from this one.
278 <td width="15%" align="right" valign="top" class="summary">
279 <span class="summary-type"> </span>
280 </td><td class="summary">
281 <a href="lxml.etree.Error-class.html" class="summary-name">Error</a>
285 <td width="15%" align="right" valign="top" class="summary">
286 <span class="summary-type"> </span>
287 </td><td class="summary">
288 <a href="lxml.etree.ErrorDomains-class.html" class="summary-name">ErrorDomains</a><br />
289 Libxml2 error domains
293 <td width="15%" align="right" valign="top" class="summary">
294 <span class="summary-type"> </span>
295 </td><td class="summary">
296 <a href="lxml.etree.ErrorLevels-class.html" class="summary-name">ErrorLevels</a><br />
301 <td width="15%" align="right" valign="top" class="summary">
302 <span class="summary-type"> </span>
303 </td><td class="summary">
304 <a href="lxml.etree.ErrorTypes-class.html" class="summary-name">ErrorTypes</a><br />
309 <td width="15%" align="right" valign="top" class="summary">
310 <span class="summary-type"> </span>
311 </td><td class="summary">
312 <a href="lxml.etree.FallbackElementClassLookup-class.html" class="summary-name">FallbackElementClassLookup</a><br />
313 FallbackElementClassLookup(self, fallback=None)
317 <td width="15%" align="right" valign="top" class="summary">
318 <span class="summary-type"> </span>
319 </td><td class="summary">
320 <a href="lxml.etree.HTMLParser-class.html" class="summary-name">HTMLParser</a><br />
321 HTMLParser(self, encoding=None, remove_blank_text=False, remove_comments=False, remove_pis=False, strip_cdata=True, no_network=True, target=None, XMLSchema schema=None, recover=True, compact=True)
325 <td width="15%" align="right" valign="top" class="summary">
326 <span class="summary-type"> </span>
327 </td><td class="summary">
328 <a href="lxml.etree.LxmlError-class.html" class="summary-name">LxmlError</a><br />
329 Main exception base class for lxml. All other exceptions inherit from
334 <td width="15%" align="right" valign="top" class="summary">
335 <span class="summary-type"> </span>
336 </td><td class="summary">
337 <a href="lxml.etree.LxmlRegistryError-class.html" class="summary-name">LxmlRegistryError</a><br />
338 Base class of lxml registry errors.
342 <td width="15%" align="right" valign="top" class="summary">
343 <span class="summary-type"> </span>
344 </td><td class="summary">
345 <a href="lxml.etree.LxmlSyntaxError-class.html" class="summary-name">LxmlSyntaxError</a><br />
346 Base class for all syntax errors.
350 <td width="15%" align="right" valign="top" class="summary">
351 <span class="summary-type"> </span>
352 </td><td class="summary">
353 <a href="lxml.etree.NamespaceRegistryError-class.html" class="summary-name">NamespaceRegistryError</a><br />
354 Error registering a namespace extension.
358 <td width="15%" align="right" valign="top" class="summary">
359 <span class="summary-type"> </span>
360 </td><td class="summary">
361 <a href="lxml.etree.PIBase-class.html" class="summary-name">PIBase</a><br />
362 All custom Processing Instruction classes must inherit from this one.
366 <td width="15%" align="right" valign="top" class="summary">
367 <span class="summary-type"> </span>
368 </td><td class="summary">
369 <a href="lxml.etree.ParseError-class.html" class="summary-name">ParseError</a><br />
370 Syntax error while parsing an XML document.
374 <td width="15%" align="right" valign="top" class="summary">
375 <span class="summary-type"> </span>
376 </td><td class="summary">
377 <a href="lxml.etree.ParserBasedElementClassLookup-class.html" class="summary-name">ParserBasedElementClassLookup</a><br />
378 ParserBasedElementClassLookup(self, fallback=None)
379 Element class lookup based on the XML parser.
383 <td width="15%" align="right" valign="top" class="summary">
384 <span class="summary-type"> </span>
385 </td><td class="summary">
386 <a href="lxml.etree.ParserError-class.html" class="summary-name">ParserError</a><br />
387 Internal lxml parser error.
391 <td width="15%" align="right" valign="top" class="summary">
392 <span class="summary-type"> </span>
393 </td><td class="summary">
394 <a href="lxml.etree.PyErrorLog-class.html" class="summary-name">PyErrorLog</a><br />
395 PyErrorLog(self, logger_name=None, logger=None)
396 A global error log that connects to the Python stdlib logging package.
400 <td width="15%" align="right" valign="top" class="summary">
401 <span class="summary-type"> </span>
402 </td><td class="summary">
403 <a href="lxml.etree.PythonElementClassLookup-class.html" class="summary-name">PythonElementClassLookup</a><br />
404 PythonElementClassLookup(self, fallback=None)
405 Element class lookup based on a subclass method.
409 <td width="15%" align="right" valign="top" class="summary">
410 <span class="summary-type"> </span>
411 </td><td class="summary">
412 <a href="lxml.etree.QName-class.html" class="summary-name">QName</a><br />
413 QName(text_or_uri_or_element, tag=None)
417 <td width="15%" align="right" valign="top" class="summary">
418 <span class="summary-type"> </span>
419 </td><td class="summary">
420 <a href="lxml.etree.RelaxNG-class.html" class="summary-name">RelaxNG</a><br />
421 RelaxNG(self, etree=None, file=None)
422 Turn a document into a Relax NG validator.
426 <td width="15%" align="right" valign="top" class="summary">
427 <span class="summary-type"> </span>
428 </td><td class="summary">
429 <a href="lxml.etree.RelaxNGError-class.html" class="summary-name">RelaxNGError</a><br />
430 Base class for RelaxNG errors.
434 <td width="15%" align="right" valign="top" class="summary">
435 <span class="summary-type"> </span>
436 </td><td class="summary">
437 <a href="lxml.etree.RelaxNGErrorTypes-class.html" class="summary-name">RelaxNGErrorTypes</a><br />
438 Libxml2 RelaxNG error types
442 <td width="15%" align="right" valign="top" class="summary">
443 <span class="summary-type"> </span>
444 </td><td class="summary">
445 <a href="lxml.etree.RelaxNGParseError-class.html" class="summary-name">RelaxNGParseError</a><br />
446 Error while parsing an XML document as RelaxNG.
450 <td width="15%" align="right" valign="top" class="summary">
451 <span class="summary-type"> </span>
452 </td><td class="summary">
453 <a href="lxml.etree.RelaxNGValidateError-class.html" class="summary-name">RelaxNGValidateError</a><br />
454 Error while validating an XML document with a RelaxNG schema.
458 <td width="15%" align="right" valign="top" class="summary">
459 <span class="summary-type"> </span>
460 </td><td class="summary">
461 <a href="lxml.etree.Resolver-class.html" class="summary-name">Resolver</a><br />
462 This is the base class of all resolvers.
466 <td width="15%" align="right" valign="top" class="summary">
467 <span class="summary-type"> </span>
468 </td><td class="summary">
469 <a href="lxml.etree.Schematron-class.html" class="summary-name">Schematron</a><br />
470 Schematron(self, etree=None, file=None)
471 A Schematron validator.
475 <td width="15%" align="right" valign="top" class="summary">
476 <span class="summary-type"> </span>
477 </td><td class="summary">
478 <a href="lxml.etree.SchematronError-class.html" class="summary-name">SchematronError</a><br />
479 Base class of all Schematron errors.
483 <td width="15%" align="right" valign="top" class="summary">
484 <span class="summary-type"> </span>
485 </td><td class="summary">
486 <a href="lxml.etree.SchematronParseError-class.html" class="summary-name">SchematronParseError</a><br />
487 Error while parsing an XML document as Schematron schema.
491 <td width="15%" align="right" valign="top" class="summary">
492 <span class="summary-type"> </span>
493 </td><td class="summary">
494 <a href="lxml.etree.SchematronValidateError-class.html" class="summary-name">SchematronValidateError</a><br />
495 Error while validating an XML document with a Schematron schema.
499 <td width="15%" align="right" valign="top" class="summary">
500 <span class="summary-type"> </span>
501 </td><td class="summary">
502 <a href="lxml.etree.SerialisationError-class.html" class="summary-name">SerialisationError</a><br />
503 A libxml2 error that occurred during serialisation.
507 <td width="15%" align="right" valign="top" class="summary">
508 <span class="summary-type"> </span>
509 </td><td class="summary">
510 <a href="lxml.etree.SiblingsIterator-class.html" class="summary-name" onclick="show_private();">SiblingsIterator</a><br />
511 SiblingsIterator(self, node, tag=None, preceding=False)
512 Iterates over the siblings of an element.
516 <td width="15%" align="right" valign="top" class="summary">
517 <span class="summary-type"> </span>
518 </td><td class="summary">
519 <a href="lxml.etree.TreeBuilder-class.html" class="summary-name">TreeBuilder</a><br />
520 TreeBuilder(self, element_factory=None, parser=None)
521 Parser target that builds a tree.
525 <td width="15%" align="right" valign="top" class="summary">
526 <span class="summary-type"> </span>
527 </td><td class="summary">
528 <a href="lxml.etree.XInclude-class.html" class="summary-name">XInclude</a><br />
534 <td width="15%" align="right" valign="top" class="summary">
535 <span class="summary-type"> </span>
536 </td><td class="summary">
537 <a href="lxml.etree.XIncludeError-class.html" class="summary-name">XIncludeError</a><br />
538 Error during XInclude processing.
542 <td width="15%" align="right" valign="top" class="summary">
543 <span class="summary-type"> </span>
544 </td><td class="summary">
545 <a href="lxml.etree.XMLParser-class.html" class="summary-name">XMLParser</a><br />
546 XMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, ns_clean=False, recover=False, XMLSchema schema=None, remove_blank_text=False, resolve_entities=True, remove_comments=False, remove_pis=False, strip_cdata=True, target=None, compact=True)
550 <td width="15%" align="right" valign="top" class="summary">
551 <span class="summary-type"> </span>
552 </td><td class="summary">
553 <a href="lxml.etree.XMLSchema-class.html" class="summary-name">XMLSchema</a><br />
554 XMLSchema(self, etree=None, file=None)
555 Turn a document into an XML Schema validator.
559 <td width="15%" align="right" valign="top" class="summary">
560 <span class="summary-type"> </span>
561 </td><td class="summary">
562 <a href="lxml.etree.XMLSchemaError-class.html" class="summary-name">XMLSchemaError</a><br />
563 Base class of all XML Schema errors
567 <td width="15%" align="right" valign="top" class="summary">
568 <span class="summary-type"> </span>
569 </td><td class="summary">
570 <a href="lxml.etree.XMLSchemaParseError-class.html" class="summary-name">XMLSchemaParseError</a><br />
571 Error while parsing an XML document as XML Schema.
575 <td width="15%" align="right" valign="top" class="summary">
576 <span class="summary-type"> </span>
577 </td><td class="summary">
578 <a href="lxml.etree.XMLSchemaValidateError-class.html" class="summary-name">XMLSchemaValidateError</a><br />
579 Error while validating an XML document with an XML Schema.
583 <td width="15%" align="right" valign="top" class="summary">
584 <span class="summary-type"> </span>
585 </td><td class="summary">
586 <a href="lxml.etree.XMLSyntaxError-class.html" class="summary-name">XMLSyntaxError</a><br />
587 Syntax error while parsing an XML document.
591 <td width="15%" align="right" valign="top" class="summary">
592 <span class="summary-type"> </span>
593 </td><td class="summary">
594 <a href="lxml.etree.ETCompatXMLParser-class.html" class="summary-name">XMLTreeBuilder</a><br />
595 ETCompatXMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, ns_clean=False, recover=False, schema=None, huge_tree=False, remove_blank_text=False, resolve_entities=True, remove_comments=True, remove_pis=True, strip_cdata=True, target=None, compact=True)
599 <td width="15%" align="right" valign="top" class="summary">
600 <span class="summary-type"> </span>
601 </td><td class="summary">
602 <a href="lxml.etree.XPath-class.html" class="summary-name">XPath</a><br />
603 XPath(self, path, namespaces=None, extensions=None, regexp=True, smart_strings=True)
604 A compiled XPath expression that can be called on Elements and ElementTrees.
608 <td width="15%" align="right" valign="top" class="summary">
609 <span class="summary-type"> </span>
610 </td><td class="summary">
611 <a href="lxml.etree.XPathDocumentEvaluator-class.html" class="summary-name">XPathDocumentEvaluator</a><br />
612 XPathDocumentEvaluator(self, etree, namespaces=None, extensions=None, regexp=True, smart_strings=True)
613 Create an XPath evaluator for an ElementTree.
617 <td width="15%" align="right" valign="top" class="summary">
618 <span class="summary-type"> </span>
619 </td><td class="summary">
620 <a href="lxml.etree.XPathElementEvaluator-class.html" class="summary-name" onclick="show_private();">XPathElementEvaluator</a><br />
621 XPathElementEvaluator(self, element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
622 Create an XPath evaluator for an element.
626 <td width="15%" align="right" valign="top" class="summary">
627 <span class="summary-type"> </span>
628 </td><td class="summary">
629 <a href="lxml.etree.XPathError-class.html" class="summary-name">XPathError</a><br />
630 Base class of all XPath errors.
634 <td width="15%" align="right" valign="top" class="summary">
635 <span class="summary-type"> </span>
636 </td><td class="summary">
637 <a href="lxml.etree.XPathEvalError-class.html" class="summary-name">XPathEvalError</a><br />
638 Error during XPath evaluation.
642 <td width="15%" align="right" valign="top" class="summary">
643 <span class="summary-type"> </span>
644 </td><td class="summary">
645 <a href="lxml.etree.XPathFunctionError-class.html" class="summary-name">XPathFunctionError</a><br />
646 Internal error looking up an XPath extension function.
650 <td width="15%" align="right" valign="top" class="summary">
651 <span class="summary-type"> </span>
652 </td><td class="summary">
653 <a href="lxml.etree.XPathResultError-class.html" class="summary-name">XPathResultError</a><br />
654 Error handling an XPath result.
658 <td width="15%" align="right" valign="top" class="summary">
659 <span class="summary-type"> </span>
660 </td><td class="summary">
661 <a href="lxml.etree.XPathSyntaxError-class.html" class="summary-name">XPathSyntaxError</a>
665 <td width="15%" align="right" valign="top" class="summary">
666 <span class="summary-type"> </span>
667 </td><td class="summary">
668 <a href="lxml.etree.XSLT-class.html" class="summary-name">XSLT</a><br />
669 XSLT(self, xslt_input, extensions=None, regexp=True, access_control=None)
673 <td width="15%" align="right" valign="top" class="summary">
674 <span class="summary-type"> </span>
675 </td><td class="summary">
676 <a href="lxml.etree.XSLTAccessControl-class.html" class="summary-name">XSLTAccessControl</a><br />
677 XSLTAccessControl(self, read_file=True, write_file=True, create_dir=True, read_network=True, write_network=True)
681 <td width="15%" align="right" valign="top" class="summary">
682 <span class="summary-type"> </span>
683 </td><td class="summary">
684 <a href="lxml.etree.XSLTApplyError-class.html" class="summary-name">XSLTApplyError</a><br />
685 Error running an XSL transformation.
689 <td width="15%" align="right" valign="top" class="summary">
690 <span class="summary-type"> </span>
691 </td><td class="summary">
692 <a href="lxml.etree.XSLTError-class.html" class="summary-name">XSLTError</a><br />
693 Base class of all XSLT errors.
697 <td width="15%" align="right" valign="top" class="summary">
698 <span class="summary-type"> </span>
699 </td><td class="summary">
700 <a href="lxml.etree.XSLTExtension-class.html" class="summary-name">XSLTExtension</a><br />
701 Base class of an XSLT extension element.
705 <td width="15%" align="right" valign="top" class="summary">
706 <span class="summary-type"> </span>
707 </td><td class="summary">
708 <a href="lxml.etree.XSLTExtensionError-class.html" class="summary-name">XSLTExtensionError</a><br />
709 Error registering an XSLT extension.
713 <td width="15%" align="right" valign="top" class="summary">
714 <span class="summary-type"> </span>
715 </td><td class="summary">
716 <a href="lxml.etree.XSLTParseError-class.html" class="summary-name">XSLTParseError</a><br />
717 Error parsing a stylesheet document.
721 <td width="15%" align="right" valign="top" class="summary">
722 <span class="summary-type"> </span>
723 </td><td class="summary">
724 <a href="lxml.etree.XSLTSaveError-class.html" class="summary-name">XSLTSaveError</a><br />
725 Error serialising an XSLT result.
729 <td width="15%" align="right" valign="top" class="summary">
730 <span class="summary-type"> </span>
731 </td><td class="summary">
732 <a href="lxml.etree._AppendOnlyElementProxy-class.html" class="summary-name" onclick="show_private();">_AppendOnlyElementProxy</a><br />
733 A read-only element that allows adding children and changing the
734 text content (i.e. everything that adds to the subtree).
738 <td width="15%" align="right" valign="top" class="summary">
739 <span class="summary-type"> </span>
740 </td><td class="summary">
741 <a href="lxml.etree._Attrib-class.html" class="summary-name" onclick="show_private();">_Attrib</a><br />
742 A dict-like proxy for the <tt class="rst-rst-docutils literal rst-docutils literal">Element.attrib</tt> property.
746 <td width="15%" align="right" valign="top" class="summary">
747 <span class="summary-type"> </span>
748 </td><td class="summary">
749 <a href="lxml.etree._AttribIterator-class.html" class="summary-name" onclick="show_private();">_AttribIterator</a><br />
750 Attribute iterator - for internal use only!
754 <td width="15%" align="right" valign="top" class="summary">
755 <span class="summary-type"> </span>
756 </td><td class="summary">
757 <a href="lxml.etree._BaseContext-class.html" class="summary-name" onclick="show_private();">_BaseContext</a>
761 <td width="15%" align="right" valign="top" class="summary">
762 <span class="summary-type"> </span>
763 </td><td class="summary">
764 <a href="lxml.etree._BaseErrorLog-class.html" class="summary-name" onclick="show_private();">_BaseErrorLog</a>
768 <td width="15%" align="right" valign="top" class="summary">
769 <span class="summary-type"> </span>
770 </td><td class="summary">
771 <a href="lxml.etree._BaseParser-class.html" class="summary-name" onclick="show_private();">_BaseParser</a>
775 <td width="15%" align="right" valign="top" class="summary">
776 <span class="summary-type"> </span>
777 </td><td class="summary">
778 <a href="lxml.etree._ClassNamespaceRegistry-class.html" class="summary-name" onclick="show_private();">_ClassNamespaceRegistry</a><br />
779 Dictionary-like registry for namespace implementation classes
783 <td width="15%" align="right" valign="top" class="summary">
784 <span class="summary-type"> </span>
785 </td><td class="summary">
786 <a href="lxml.etree._Comment-class.html" class="summary-name" onclick="show_private();">_Comment</a>
790 <td width="15%" align="right" valign="top" class="summary">
791 <span class="summary-type"> </span>
792 </td><td class="summary">
793 <a href="lxml.etree._Document-class.html" class="summary-name" onclick="show_private();">_Document</a><br />
794 Internal base class to reference a libxml document.
798 <td width="15%" align="right" valign="top" class="summary">
799 <span class="summary-type"> </span>
800 </td><td class="summary">
801 <a href="lxml.etree._DomainErrorLog-class.html" class="summary-name" onclick="show_private();">_DomainErrorLog</a>
805 <td width="15%" align="right" valign="top" class="summary">
806 <span class="summary-type"> </span>
807 </td><td class="summary">
808 <a href="lxml.etree._Element-class.html" class="summary-name" onclick="show_private();">_Element</a><br />
813 <td width="15%" align="right" valign="top" class="summary">
814 <span class="summary-type"> </span>
815 </td><td class="summary">
816 <a href="lxml.etree._ElementIterator-class.html" class="summary-name" onclick="show_private();">_ElementIterator</a>
820 <td width="15%" align="right" valign="top" class="summary">
821 <span class="summary-type"> </span>
822 </td><td class="summary">
823 <a href="lxml.etree._ElementStringResult-class.html" class="summary-name" onclick="show_private();">_ElementStringResult</a>
827 <td width="15%" align="right" valign="top" class="summary">
828 <span class="summary-type"> </span>
829 </td><td class="summary">
830 <a href="lxml.etree._ElementTagMatcher-class.html" class="summary-name" onclick="show_private();">_ElementTagMatcher</a>
834 <td width="15%" align="right" valign="top" class="summary">
835 <span class="summary-type"> </span>
836 </td><td class="summary">
837 <a href="lxml.etree._ElementTree-class.html" class="summary-name" onclick="show_private();">_ElementTree</a>
841 <td width="15%" align="right" valign="top" class="summary">
842 <span class="summary-type"> </span>
843 </td><td class="summary">
844 <a href="lxml.etree._ElementUnicodeResult-class.html" class="summary-name" onclick="show_private();">_ElementUnicodeResult</a>
848 <td width="15%" align="right" valign="top" class="summary">
849 <span class="summary-type"> </span>
850 </td><td class="summary">
851 <a href="lxml.etree._Entity-class.html" class="summary-name" onclick="show_private();">_Entity</a>
855 <td width="15%" align="right" valign="top" class="summary">
856 <span class="summary-type"> </span>
857 </td><td class="summary">
858 <a href="lxml.etree._ErrorLog-class.html" class="summary-name" onclick="show_private();">_ErrorLog</a>
862 <td width="15%" align="right" valign="top" class="summary">
863 <span class="summary-type"> </span>
864 </td><td class="summary">
865 <a href="lxml.etree._ExceptionContext-class.html" class="summary-name" onclick="show_private();">_ExceptionContext</a>
869 <td width="15%" align="right" valign="top" class="summary">
870 <span class="summary-type"> </span>
871 </td><td class="summary">
872 <a href="lxml.etree._ExsltRegExp-class.html" class="summary-name" onclick="show_private();">_ExsltRegExp</a>
876 <td width="15%" align="right" valign="top" class="summary">
877 <span class="summary-type"> </span>
878 </td><td class="summary">
879 <a href="lxml.etree._FeedParser-class.html" class="summary-name" onclick="show_private();">_FeedParser</a>
883 <td width="15%" align="right" valign="top" class="summary">
884 <span class="summary-type"> </span>
885 </td><td class="summary">
886 <a href="lxml.etree._FileReaderContext-class.html" class="summary-name" onclick="show_private();">_FileReaderContext</a>
890 <td width="15%" align="right" valign="top" class="summary">
891 <span class="summary-type"> </span>
892 </td><td class="summary">
893 <a href="lxml.etree._FilelikeWriter-class.html" class="summary-name" onclick="show_private();">_FilelikeWriter</a>
897 <td width="15%" align="right" valign="top" class="summary">
898 <span class="summary-type"> </span>
899 </td><td class="summary">
900 <a href="lxml.etree._FunctionNamespaceRegistry-class.html" class="summary-name" onclick="show_private();">_FunctionNamespaceRegistry</a>
904 <td width="15%" align="right" valign="top" class="summary">
905 <span class="summary-type"> </span>
906 </td><td class="summary">
907 <a href="lxml.etree._IDDict-class.html" class="summary-name" onclick="show_private();">_IDDict</a><br />
909 A dictionary-like proxy class that mapps ID attributes to elements.
913 <td width="15%" align="right" valign="top" class="summary">
914 <span class="summary-type"> </span>
915 </td><td class="summary">
916 <a href="lxml.etree._InputDocument-class.html" class="summary-name" onclick="show_private();">_InputDocument</a>
920 <td width="15%" align="right" valign="top" class="summary">
921 <span class="summary-type"> </span>
922 </td><td class="summary">
923 <a href="lxml.etree._IterparseContext-class.html" class="summary-name" onclick="show_private();">_IterparseContext</a>
927 <td width="15%" align="right" valign="top" class="summary">
928 <span class="summary-type"> </span>
929 </td><td class="summary">
930 <a href="lxml.etree._ListErrorLog-class.html" class="summary-name" onclick="show_private();">_ListErrorLog</a><br />
931 Immutable base version of a list based error log.
935 <td width="15%" align="right" valign="top" class="summary">
936 <span class="summary-type"> </span>
937 </td><td class="summary">
938 <a href="lxml.etree._LogEntry-class.html" class="summary-name" onclick="show_private();">_LogEntry</a><br />
939 A log message entry from an error log.
943 <td width="15%" align="right" valign="top" class="summary">
944 <span class="summary-type"> </span>
945 </td><td class="summary">
946 <a href="lxml.etree._ModifyContentOnlyEntityProxy-class.html" class="summary-name" onclick="show_private();">_ModifyContentOnlyEntityProxy</a><br />
947 A read-only proxy for entity references (for internal use only!)
951 <td width="15%" align="right" valign="top" class="summary">
952 <span class="summary-type"> </span>
953 </td><td class="summary">
954 <a href="lxml.etree._ModifyContentOnlyPIProxy-class.html" class="summary-name" onclick="show_private();">_ModifyContentOnlyPIProxy</a><br />
955 A read-only proxy that allows changing the text/target content of a
956 processing instruction.
960 <td width="15%" align="right" valign="top" class="summary">
961 <span class="summary-type"> </span>
962 </td><td class="summary">
963 <a href="lxml.etree._ModifyContentOnlyProxy-class.html" class="summary-name" onclick="show_private();">_ModifyContentOnlyProxy</a><br />
964 A read-only proxy that allows changing the text content.
968 <td width="15%" align="right" valign="top" class="summary">
969 <span class="summary-type"> </span>
970 </td><td class="summary">
971 <a href="lxml.etree._NamespaceRegistry-class.html" class="summary-name" onclick="show_private();">_NamespaceRegistry</a><br />
972 Dictionary-like namespace registry
976 <td width="15%" align="right" valign="top" class="summary">
977 <span class="summary-type"> </span>
978 </td><td class="summary">
979 <a href="lxml.etree._OpaqueDocumentWrapper-class.html" class="summary-name" onclick="show_private();">_OpaqueDocumentWrapper</a>
983 <td width="15%" align="right" valign="top" class="summary">
984 <span class="summary-type"> </span>
985 </td><td class="summary">
986 <a href="lxml.etree._OpaqueNodeWrapper-class.html" class="summary-name" onclick="show_private();">_OpaqueNodeWrapper</a>
990 <td width="15%" align="right" valign="top" class="summary">
991 <span class="summary-type"> </span>
992 </td><td class="summary">
993 <a href="lxml.etree._ParserContext-class.html" class="summary-name" onclick="show_private();">_ParserContext</a>
997 <td width="15%" align="right" valign="top" class="summary">
998 <span class="summary-type"> </span>
999 </td><td class="summary">
1000 <a href="lxml.etree._ParserDictionaryContext-class.html" class="summary-name" onclick="show_private();">_ParserDictionaryContext</a>
1003 <tr class="private">
1004 <td width="15%" align="right" valign="top" class="summary">
1005 <span class="summary-type"> </span>
1006 </td><td class="summary">
1007 <a href="lxml.etree._ParserSchemaValidationContext-class.html" class="summary-name" onclick="show_private();">_ParserSchemaValidationContext</a>
1010 <tr class="private">
1011 <td width="15%" align="right" valign="top" class="summary">
1012 <span class="summary-type"> </span>
1013 </td><td class="summary">
1014 <a href="lxml.etree._ProcessingInstruction-class.html" class="summary-name" onclick="show_private();">_ProcessingInstruction</a>
1017 <tr class="private">
1018 <td width="15%" align="right" valign="top" class="summary">
1019 <span class="summary-type"> </span>
1020 </td><td class="summary">
1021 <a href="lxml.etree._PythonSaxParserTarget-class.html" class="summary-name" onclick="show_private();">_PythonSaxParserTarget</a>
1024 <tr class="private">
1025 <td width="15%" align="right" valign="top" class="summary">
1026 <span class="summary-type"> </span>
1027 </td><td class="summary">
1028 <a href="lxml.etree._ReadOnlyElementProxy-class.html" class="summary-name" onclick="show_private();">_ReadOnlyElementProxy</a><br />
1029 The main read-only Element proxy class (for internal use only!).
1032 <tr class="private">
1033 <td width="15%" align="right" valign="top" class="summary">
1034 <span class="summary-type"> </span>
1035 </td><td class="summary">
1036 <a href="lxml.etree._ReadOnlyEntityProxy-class.html" class="summary-name" onclick="show_private();">_ReadOnlyEntityProxy</a><br />
1037 A read-only proxy for entity references (for internal use only!)
1040 <tr class="private">
1041 <td width="15%" align="right" valign="top" class="summary">
1042 <span class="summary-type"> </span>
1043 </td><td class="summary">
1044 <a href="lxml.etree._ReadOnlyPIProxy-class.html" class="summary-name" onclick="show_private();">_ReadOnlyPIProxy</a><br />
1045 A read-only proxy for processing instructions (for internal use only!)
1048 <tr class="private">
1049 <td width="15%" align="right" valign="top" class="summary">
1050 <span class="summary-type"> </span>
1051 </td><td class="summary">
1052 <a href="lxml.etree._ReadOnlyProxy-class.html" class="summary-name" onclick="show_private();">_ReadOnlyProxy</a><br />
1053 A read-only proxy class suitable for PIs/Comments (for internal use only!).
1056 <tr class="private">
1057 <td width="15%" align="right" valign="top" class="summary">
1058 <span class="summary-type"> </span>
1059 </td><td class="summary">
1060 <a href="lxml.etree._ResolverContext-class.html" class="summary-name" onclick="show_private();">_ResolverContext</a>
1063 <tr class="private">
1064 <td width="15%" align="right" valign="top" class="summary">
1065 <span class="summary-type"> </span>
1066 </td><td class="summary">
1067 <a href="lxml.etree._ResolverRegistry-class.html" class="summary-name" onclick="show_private();">_ResolverRegistry</a>
1070 <tr class="private">
1071 <td width="15%" align="right" valign="top" class="summary">
1072 <span class="summary-type"> </span>
1073 </td><td class="summary">
1074 <a href="lxml.etree._RotatingErrorLog-class.html" class="summary-name" onclick="show_private();">_RotatingErrorLog</a>
1077 <tr class="private">
1078 <td width="15%" align="right" valign="top" class="summary">
1079 <span class="summary-type"> </span>
1080 </td><td class="summary">
1081 <a href="lxml.etree._SaxParserContext-class.html" class="summary-name" onclick="show_private();">_SaxParserContext</a><br />
1082 This class maps SAX2 events to method calls.
1085 <tr class="private">
1086 <td width="15%" align="right" valign="top" class="summary">
1087 <span class="summary-type"> </span>
1088 </td><td class="summary">
1089 <a href="lxml.etree._SaxParserTarget-class.html" class="summary-name" onclick="show_private();">_SaxParserTarget</a>
1092 <tr class="private">
1093 <td width="15%" align="right" valign="top" class="summary">
1094 <span class="summary-type"> </span>
1095 </td><td class="summary">
1096 <a href="lxml.etree._TargetParserContext-class.html" class="summary-name" onclick="show_private();">_TargetParserContext</a><br />
1097 This class maps SAX2 events to the ET parser target interface.
1100 <tr class="private">
1101 <td width="15%" align="right" valign="top" class="summary">
1102 <span class="summary-type"> </span>
1103 </td><td class="summary">
1104 <a href="lxml.etree._TargetParserResult-class.html" class="summary-name" onclick="show_private();">_TargetParserResult</a>
1107 <tr class="private">
1108 <td width="15%" align="right" valign="top" class="summary">
1109 <span class="summary-type"> </span>
1110 </td><td class="summary">
1111 <a href="lxml.etree._TempStore-class.html" class="summary-name" onclick="show_private();">_TempStore</a>
1114 <tr class="private">
1115 <td width="15%" align="right" valign="top" class="summary">
1116 <span class="summary-type"> </span>
1117 </td><td class="summary">
1118 <a href="lxml.etree._Validator-class.html" class="summary-name" onclick="show_private();">_Validator</a><br />
1119 Base class for XML validators.
1122 <tr class="private">
1123 <td width="15%" align="right" valign="top" class="summary">
1124 <span class="summary-type"> </span>
1125 </td><td class="summary">
1126 <a href="lxml.etree._XPathContext-class.html" class="summary-name" onclick="show_private();">_XPathContext</a>
1129 <tr class="private">
1130 <td width="15%" align="right" valign="top" class="summary">
1131 <span class="summary-type"> </span>
1132 </td><td class="summary">
1133 <a href="lxml.etree._XPathEvaluatorBase-class.html" class="summary-name" onclick="show_private();">_XPathEvaluatorBase</a>
1136 <tr class="private">
1137 <td width="15%" align="right" valign="top" class="summary">
1138 <span class="summary-type"> </span>
1139 </td><td class="summary">
1140 <a href="lxml.etree._XPathFunctionNamespaceRegistry-class.html" class="summary-name" onclick="show_private();">_XPathFunctionNamespaceRegistry</a>
1143 <tr class="private">
1144 <td width="15%" align="right" valign="top" class="summary">
1145 <span class="summary-type"> </span>
1146 </td><td class="summary">
1147 <a href="lxml.etree._XSLTContext-class.html" class="summary-name" onclick="show_private();">_XSLTContext</a>
1150 <tr class="private">
1151 <td width="15%" align="right" valign="top" class="summary">
1152 <span class="summary-type"> </span>
1153 </td><td class="summary">
1154 <a href="lxml.etree._XSLTProcessingInstruction-class.html" class="summary-name" onclick="show_private();">_XSLTProcessingInstruction</a>
1157 <tr class="private">
1158 <td width="15%" align="right" valign="top" class="summary">
1159 <span class="summary-type"> </span>
1160 </td><td class="summary">
1161 <a href="lxml.etree._XSLTQuotedStringParam-class.html" class="summary-name" onclick="show_private();">_XSLTQuotedStringParam</a><br />
1162 A wrapper class for literal XSLT string parameters that require
1166 <tr class="private">
1167 <td width="15%" align="right" valign="top" class="summary">
1168 <span class="summary-type"> </span>
1169 </td><td class="summary">
1170 <a href="lxml.etree._XSLTResolverContext-class.html" class="summary-name" onclick="show_private();">_XSLTResolverContext</a>
1173 <tr class="private">
1174 <td width="15%" align="right" valign="top" class="summary">
1175 <span class="summary-type"> </span>
1176 </td><td class="summary">
1177 <a href="lxml.etree._XSLTResultTree-class.html" class="summary-name" onclick="show_private();">_XSLTResultTree</a>
1180 <tr class="private">
1181 <td width="15%" align="right" valign="top" class="summary">
1182 <span class="summary-type"> </span>
1183 </td><td class="summary">
1184 <a href="lxml.etree.__ContentOnlyElement-class.html" class="summary-name" onclick="show_private();">__ContentOnlyElement</a>
1188 <td width="15%" align="right" valign="top" class="summary">
1189 <span class="summary-type"> </span>
1190 </td><td class="summary">
1191 <a href="lxml.etree.iterparse-class.html" class="summary-name">iterparse</a><br />
1192 iterparse(self, source, events=("end",), tag=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, remove_blank_text=False, remove_comments=False, remove_pis=False, encoding=None, html=False, huge_tree=False, schema=None)
1196 <td width="15%" align="right" valign="top" class="summary">
1197 <span class="summary-type"> </span>
1198 </td><td class="summary">
1199 <a href="lxml.etree.iterwalk-class.html" class="summary-name">iterwalk</a><br />
1200 iterwalk(self, element_or_tree, events=("end",), tag=None)
1204 <!-- ==================== FUNCTIONS ==================== -->
1205 <a name="section-Functions"></a>
1206 <table class="summary" border="1" cellpadding="3"
1207 cellspacing="0" width="100%" bgcolor="white">
1208 <tr bgcolor="#70b0f0" class="table-header">
1209 <td colspan="2" class="table-header">
1210 <table border="0" cellpadding="0" cellspacing="0" width="100%">
1212 <td align="left"><span class="table-header">Functions</span></td>
1213 <td align="right" valign="top"
1214 ><span class="options">[<a href="#section-Functions"
1215 class="privatelink" onclick="toggle_private();"
1216 >hide private</a>]</span></td>
1222 <td width="15%" align="right" valign="top" class="summary">
1223 <span class="summary-type"> </span>
1224 </td><td class="summary">
1225 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1227 <td><span class="summary-sig"><a name="Comment"></a><span class="summary-sig-name">Comment</span>(<span class="summary-sig-arg">text</span>=<span class="summary-sig-default">None</span>)</span><br />
1228 Comment element factory. This factory function creates a special element that will
1229 be serialized as an XML comment.</td>
1230 <td align="right" valign="top">
1240 <td width="15%" align="right" valign="top" class="summary">
1241 <span class="summary-type"> </span>
1242 </td><td class="summary">
1243 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1245 <td><span class="summary-sig"><a href="lxml.etree-module.html#Element" class="summary-sig-name">Element</a>(<span class="summary-sig-arg">_tag</span>,
1246 <span class="summary-sig-arg">attrib</span>=<span class="summary-sig-default">None</span>,
1247 <span class="summary-sig-arg">nsmap</span>=<span class="summary-sig-default">None</span>,
1248 <span class="summary-sig-arg">**_extra</span>)</span><br />
1249 Element factory. This function returns an object implementing the
1250 Element interface.</td>
1251 <td align="right" valign="top">
1261 <td width="15%" align="right" valign="top" class="summary">
1262 <span class="summary-type"> </span>
1263 </td><td class="summary">
1264 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1266 <td><span class="summary-sig"><a name="ElementTree"></a><span class="summary-sig-name">ElementTree</span>(<span class="summary-sig-arg">element</span>=<span class="summary-sig-default">None</span>,
1267 <span class="summary-sig-arg">file</span>=<span class="summary-sig-default">None</span>,
1268 <span class="summary-sig-arg">parser</span>=<span class="summary-sig-default">None</span>)</span><br />
1269 ElementTree wrapper class.</td>
1270 <td align="right" valign="top">
1280 <td width="15%" align="right" valign="top" class="summary">
1281 <span class="summary-type"> </span>
1282 </td><td class="summary">
1283 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1285 <td><span class="summary-sig"><a name="Entity"></a><span class="summary-sig-name">Entity</span>(<span class="summary-sig-arg">name</span>)</span><br />
1286 Entity factory. This factory function creates a special element
1287 that will be serialized as an XML entity reference or character
1288 reference. Note, however, that entities will not be automatically
1289 declared in the document. A document that uses entity references
1290 requires a DTD to define the entities.</td>
1291 <td align="right" valign="top">
1301 <td width="15%" align="right" valign="top" class="summary">
1302 <span class="summary-type"> </span>
1303 </td><td class="summary">
1304 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1306 <td><span class="summary-sig"><a href="lxml.etree-module.html#Extension" class="summary-sig-name">Extension</a>(<span class="summary-sig-arg">module</span>,
1307 <span class="summary-sig-arg">function_mapping</span>=<span class="summary-sig-default">None</span>,
1308 <span class="summary-sig-arg">ns</span>=<span class="summary-sig-default">None</span>)</span><br />
1309 Build a dictionary of extension functions from the functions
1310 defined in a module or the methods of an object.</td>
1311 <td align="right" valign="top">
1321 <td width="15%" align="right" valign="top" class="summary">
1322 <span class="summary-type"> </span>
1323 </td><td class="summary">
1324 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1326 <td><span class="summary-sig"><a href="lxml.etree-module.html#FunctionNamespace" class="summary-sig-name">FunctionNamespace</a>(<span class="summary-sig-arg">ns_uri</span>)</span><br />
1327 Retrieve the function namespace object associated with the given
1329 <td align="right" valign="top">
1339 <td width="15%" align="right" valign="top" class="summary">
1340 <span class="summary-type"> </span>
1341 </td><td class="summary">
1342 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1344 <td><span class="summary-sig"><a href="lxml.etree-module.html#HTML" class="summary-sig-name">HTML</a>(<span class="summary-sig-arg">text</span>,
1345 <span class="summary-sig-arg">parser</span>=<span class="summary-sig-default">None</span>,
1346 <span class="summary-sig-arg">base_url</span>=<span class="summary-sig-default">None</span>)</span><br />
1347 Parses an HTML document from a string constant. Returns the root
1348 node (or the result returned by a parser target). This function
1349 can be used to embed "HTML literals" in Python code.</td>
1350 <td align="right" valign="top">
1360 <td width="15%" align="right" valign="top" class="summary">
1361 <span class="summary-type"> </span>
1362 </td><td class="summary">
1363 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1365 <td><span class="summary-sig"><a name="PI"></a><span class="summary-sig-name">PI</span>(<span class="summary-sig-arg">target</span>,
1366 <span class="summary-sig-arg">text</span>=<span class="summary-sig-default">None</span>)</span><br />
1367 ProcessingInstruction element factory. This factory function creates a
1368 special element that will be serialized as an XML processing instruction.</td>
1369 <td align="right" valign="top">
1379 <td width="15%" align="right" valign="top" class="summary">
1380 <span class="summary-type"> </span>
1381 </td><td class="summary">
1382 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1384 <td><span class="summary-sig"><a name="ProcessingInstruction"></a><span class="summary-sig-name">ProcessingInstruction</span>(<span class="summary-sig-arg">target</span>,
1385 <span class="summary-sig-arg">text</span>=<span class="summary-sig-default">None</span>)</span><br />
1386 ProcessingInstruction element factory. This factory function creates a
1387 special element that will be serialized as an XML processing instruction.</td>
1388 <td align="right" valign="top">
1398 <td width="15%" align="right" valign="top" class="summary">
1399 <span class="summary-type"> </span>
1400 </td><td class="summary">
1401 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1403 <td><span class="summary-sig"><a name="SubElement"></a><span class="summary-sig-name">SubElement</span>(<span class="summary-sig-arg">_parent</span>,
1404 <span class="summary-sig-arg">_tag</span>,
1405 <span class="summary-sig-arg">attrib</span>=<span class="summary-sig-default">None</span>,
1406 <span class="summary-sig-arg">nsmap</span>=<span class="summary-sig-default">None</span>,
1407 <span class="summary-sig-arg">**_extra</span>)</span><br />
1408 Subelement factory. This function creates an element instance, and
1409 appends it to an existing element.</td>
1410 <td align="right" valign="top">
1420 <td width="15%" align="right" valign="top" class="summary">
1421 <span class="summary-type"> </span>
1422 </td><td class="summary">
1423 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1425 <td><span class="summary-sig"><a href="lxml.etree-module.html#XML" class="summary-sig-name">XML</a>(<span class="summary-sig-arg">text</span>,
1426 <span class="summary-sig-arg">parser</span>=<span class="summary-sig-default">None</span>,
1427 <span class="summary-sig-arg">base_url</span>=<span class="summary-sig-default">None</span>)</span><br />
1428 Parses an XML document or fragment from a string constant.
1429 Returns the root node (or the result returned by a parser target).
1430 This function can be used to embed "XML literals" in Python code,
1432 <td align="right" valign="top">
1442 <td width="15%" align="right" valign="top" class="summary">
1443 <span class="summary-type"> </span>
1444 </td><td class="summary">
1445 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1447 <td><span class="summary-sig"><a href="lxml.etree-module.html#XMLDTDID" class="summary-sig-name">XMLDTDID</a>(<span class="summary-sig-arg">text</span>,
1448 <span class="summary-sig-arg">parser</span>=<span class="summary-sig-default">None</span>,
1449 <span class="summary-sig-arg">base_url</span>=<span class="summary-sig-default">None</span>)</span><br />
1450 Parse the text and return a tuple (root node, ID dictionary). The root
1451 node is the same as returned by the XML() function. The dictionary
1452 contains string-element pairs. The dictionary keys are the values of ID
1453 attributes as defined by the DTD. The elements referenced by the ID are
1454 stored as dictionary values.</td>
1455 <td align="right" valign="top">
1465 <td width="15%" align="right" valign="top" class="summary">
1466 <span class="summary-type"> </span>
1467 </td><td class="summary">
1468 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1470 <td><span class="summary-sig"><a name="XMLID"></a><span class="summary-sig-name">XMLID</span>(<span class="summary-sig-arg">text</span>,
1471 <span class="summary-sig-arg">parser</span>=<span class="summary-sig-default">None</span>,
1472 <span class="summary-sig-arg">base_url</span>=<span class="summary-sig-default">None</span>)</span><br />
1473 Parse the text and return a tuple (root node, ID dictionary). The root
1474 node is the same as returned by the XML() function. The dictionary
1475 contains string-element pairs. The dictionary keys are the values of 'id'
1476 attributes. The elements referenced by the ID are stored as dictionary
1478 <td align="right" valign="top">
1488 <td width="15%" align="right" valign="top" class="summary">
1489 <span class="summary-type"> </span>
1490 </td><td class="summary">
1491 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1493 <td><span class="summary-sig"><a href="lxml.etree-module.html#XPathEvaluator" class="summary-sig-name">XPathEvaluator</a>(<span class="summary-sig-arg">etree_or_element</span>,
1494 <span class="summary-sig-arg">namespaces</span>=<span class="summary-sig-default">None</span>,
1495 <span class="summary-sig-arg">extensions</span>=<span class="summary-sig-default">None</span>,
1496 <span class="summary-sig-arg">regexp</span>=<span class="summary-sig-default">True</span>,
1497 <span class="summary-sig-arg">smart_strings</span>=<span class="summary-sig-default">True</span>)</span><br />
1498 Creates an XPath evaluator for an ElementTree or an Element.</td>
1499 <td align="right" valign="top">
1509 <td width="15%" align="right" valign="top" class="summary">
1510 <span class="summary-type"> </span>
1511 </td><td class="summary">
1512 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1514 <td><span class="summary-sig"><a name="cleanup_namespaces"></a><span class="summary-sig-name">cleanup_namespaces</span>(<span class="summary-sig-arg">tree_or_element</span>)</span><br />
1515 Remove all namespace declarations from a subtree that are not used
1516 by any of the elements or attributes in that tree.</td>
1517 <td align="right" valign="top">
1527 <td width="15%" align="right" valign="top" class="summary">
1528 <span class="summary-type"> </span>
1529 </td><td class="summary">
1530 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1532 <td><span class="summary-sig"><a href="lxml.etree-module.html#clear_error_log" class="summary-sig-name">clear_error_log</a>()</span><br />
1533 Clear the global error log. Note that this log is already bound to a
1535 <td align="right" valign="top">
1545 <td width="15%" align="right" valign="top" class="summary">
1546 <span class="summary-type"> </span>
1547 </td><td class="summary">
1548 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1550 <td><span class="summary-sig"><a name="dump"></a><span class="summary-sig-name">dump</span>(<span class="summary-sig-arg">elem</span>,
1551 <span class="summary-sig-arg">pretty_print</span>=<span class="summary-sig-default">True</span>,
1552 <span class="summary-sig-arg">with_tail</span>=<span class="summary-sig-default">True</span>)</span><br />
1553 Writes an element tree or element structure to sys.stdout. This function
1554 should be used for debugging only.</td>
1555 <td align="right" valign="top">
1565 <td width="15%" align="right" valign="top" class="summary">
1566 <span class="summary-type"> </span>
1567 </td><td class="summary">
1568 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1570 <td><span class="summary-sig"><a href="lxml.etree-module.html#fromstring" class="summary-sig-name">fromstring</a>(<span class="summary-sig-arg">text</span>,
1571 <span class="summary-sig-arg">parser</span>=<span class="summary-sig-default">None</span>,
1572 <span class="summary-sig-arg">base_url</span>=<span class="summary-sig-default">None</span>)</span><br />
1573 Parses an XML document or fragment from a string. Returns the
1574 root node (or the result returned by a parser target).</td>
1575 <td align="right" valign="top">
1585 <td width="15%" align="right" valign="top" class="summary">
1586 <span class="summary-type"> </span>
1587 </td><td class="summary">
1588 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1590 <td><span class="summary-sig"><a href="lxml.etree-module.html#fromstringlist" class="summary-sig-name">fromstringlist</a>(<span class="summary-sig-arg">strings</span>,
1591 <span class="summary-sig-arg">parser</span>=<span class="summary-sig-default">None</span>)</span><br />
1592 Parses an XML document from a sequence of strings. Returns the
1593 root node (or the result returned by a parser target).</td>
1594 <td align="right" valign="top">
1604 <td width="15%" align="right" valign="top" class="summary">
1605 <span class="summary-type"> </span>
1606 </td><td class="summary">
1607 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1609 <td><span class="summary-sig"><a name="get_default_parser"></a><span class="summary-sig-name">get_default_parser</span>()</span></td>
1610 <td align="right" valign="top">
1620 <td width="15%" align="right" valign="top" class="summary">
1621 <span class="summary-type"> </span>
1622 </td><td class="summary">
1623 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1625 <td><span class="summary-sig"><a name="iselement"></a><span class="summary-sig-name">iselement</span>(<span class="summary-sig-arg">element</span>)</span><br />
1626 Checks if an object appears to be a valid element object.</td>
1627 <td align="right" valign="top">
1637 <td width="15%" align="right" valign="top" class="summary">
1638 <span class="summary-type"> </span>
1639 </td><td class="summary">
1640 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1642 <td><span class="summary-sig"><a href="lxml.etree-module.html#parse" class="summary-sig-name">parse</a>(<span class="summary-sig-arg">source</span>,
1643 <span class="summary-sig-arg">parser</span>=<span class="summary-sig-default">None</span>,
1644 <span class="summary-sig-arg">base_url</span>=<span class="summary-sig-default">None</span>)</span><br />
1645 Return an ElementTree object loaded with source elements. If no parser
1646 is provided as second argument, the default parser is used.</td>
1647 <td align="right" valign="top">
1657 <td width="15%" align="right" valign="top" class="summary">
1658 <span class="summary-type"> </span>
1659 </td><td class="summary">
1660 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1662 <td><span class="summary-sig"><a href="lxml.etree-module.html#parseid" class="summary-sig-name">parseid</a>(<span class="summary-sig-arg">source</span>,
1663 <span class="summary-sig-arg">parser</span>=<span class="summary-sig-default">None</span>)</span><br />
1664 Parses the source into a tuple containing an ElementTree object and an
1665 ID dictionary. If no parser is provided as second argument, the default
1666 parser is used.</td>
1667 <td align="right" valign="top">
1677 <td width="15%" align="right" valign="top" class="summary">
1678 <span class="summary-type"> </span>
1679 </td><td class="summary">
1680 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1682 <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 />
1683 Registers a namespace prefix that newly created Elements in that
1684 namespace will use. The registry is global, and any existing
1685 mapping for either the given prefix or the namespace URI will be
1687 <td align="right" valign="top">
1697 <td width="15%" align="right" valign="top" class="summary">
1698 <span class="summary-type"> </span>
1699 </td><td class="summary">
1700 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1702 <td><span class="summary-sig"><a href="lxml.etree-module.html#set_default_parser" class="summary-sig-name">set_default_parser</a>(<span class="summary-sig-arg">parser</span>=<span class="summary-sig-default">None</span>)</span><br />
1703 Set a default parser for the current thread. This parser is used
1704 globally whenever no parser is supplied to the various parse functions of
1705 the lxml API. If this function is called without a parser (or if it is
1706 None), the default parser is reset to the original configuration.</td>
1707 <td align="right" valign="top">
1717 <td width="15%" align="right" valign="top" class="summary">
1718 <span class="summary-type"> </span>
1719 </td><td class="summary">
1720 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1722 <td><span class="summary-sig"><a name="set_element_class_lookup"></a><span class="summary-sig-name">set_element_class_lookup</span>(<span class="summary-sig-arg">lookup</span>=<span class="summary-sig-default"> None</span>)</span><br />
1723 Set the global default element class lookup method.</td>
1724 <td align="right" valign="top">
1734 <td width="15%" align="right" valign="top" class="summary">
1735 <span class="summary-type"> </span>
1736 </td><td class="summary">
1737 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1739 <td><span class="summary-sig"><a href="lxml.etree-module.html#strip_attributes" class="summary-sig-name">strip_attributes</a>(<span class="summary-sig-arg">tree_or_element</span>,
1740 <span class="summary-sig-arg">*attribute_names</span>)</span><br />
1741 Delete all attributes with the provided attribute names from an
1742 Element (or ElementTree) and its descendants.</td>
1743 <td align="right" valign="top">
1753 <td width="15%" align="right" valign="top" class="summary">
1754 <span class="summary-type"> </span>
1755 </td><td class="summary">
1756 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1758 <td><span class="summary-sig"><a href="lxml.etree-module.html#strip_elements" class="summary-sig-name">strip_elements</a>(<span class="summary-sig-arg">tree_or_element</span>,
1759 <span class="summary-sig-arg">with_tail</span>=<span class="summary-sig-default">True</span>,
1760 <span class="summary-sig-arg">*tag_names</span>)</span><br />
1761 Delete all elements with the provided tag names from a tree or
1762 subtree. This will remove the elements and their entire subtree,
1763 including all their attributes, text content and descendants. It
1764 will also remove the tail text of the element unless you
1765 explicitly set the <tt class="rst-docutils literal">with_tail</tt> keyword argument option to False.</td>
1766 <td align="right" valign="top">
1776 <td width="15%" align="right" valign="top" class="summary">
1777 <span class="summary-type"> </span>
1778 </td><td class="summary">
1779 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1781 <td><span class="summary-sig"><a href="lxml.etree-module.html#strip_tags" class="summary-sig-name">strip_tags</a>(<span class="summary-sig-arg">tree_or_element</span>,
1782 <span class="summary-sig-arg">*tag_names</span>)</span><br />
1783 Delete all elements with the provided tag names from a tree or
1784 subtree. This will remove the elements and their attributes, but
1785 <em>not</em> their text/tail content or descendants. Instead, it will
1786 merge the text content and children of the element into its
1788 <td align="right" valign="top">
1798 <td width="15%" align="right" valign="top" class="summary">
1799 <span class="summary-type"> </span>
1800 </td><td class="summary">
1801 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1803 <td><span class="summary-sig"><a href="lxml.etree-module.html#tostring" class="summary-sig-name">tostring</a>(<span class="summary-sig-arg">element_or_tree</span>,
1804 <span class="summary-sig-arg">encoding</span>=<span class="summary-sig-default">None</span>,
1805 <span class="summary-sig-arg">method</span>=<span class="summary-sig-default">"xml"</span>,
1806 <span class="summary-sig-arg">xml_declaration</span>=<span class="summary-sig-default">None</span>,
1807 <span class="summary-sig-arg">pretty_print</span>=<span class="summary-sig-default">False</span>,
1808 <span class="summary-sig-arg">with_tail</span>=<span class="summary-sig-default">True</span>,
1809 <span class="summary-sig-arg">standalone</span>=<span class="summary-sig-default">None</span>,
1810 <span class="summary-sig-arg">doctype</span>=<span class="summary-sig-default">None</span>,
1811 <span class="summary-sig-arg">exclusive</span>=<span class="summary-sig-default">False</span>,
1812 <span class="summary-sig-arg">with_comments</span>=<span class="summary-sig-default">True</span>)</span><br />
1813 Serialize an element to an encoded string representation of its XML
1815 <td align="right" valign="top">
1825 <td width="15%" align="right" valign="top" class="summary">
1826 <span class="summary-type"> </span>
1827 </td><td class="summary">
1828 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1830 <td><span class="summary-sig"><a href="lxml.etree-module.html#tostringlist" class="summary-sig-name">tostringlist</a>(<span class="summary-sig-arg">element_or_tree</span>,
1831 <span class="summary-sig-arg">*args</span>,
1832 <span class="summary-sig-arg">**kwargs</span>)</span><br />
1833 Serialize an element to an encoded string representation of its XML
1834 tree, stored in a list of partial strings.</td>
1835 <td align="right" valign="top">
1845 <td width="15%" align="right" valign="top" class="summary">
1846 <span class="summary-type"> </span>
1847 </td><td class="summary">
1848 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1850 <td><span class="summary-sig"><a href="lxml.etree-module.html#tounicode" class="summary-sig-name">tounicode</a>(<span class="summary-sig-arg">element_or_tree</span>,
1851 <span class="summary-sig-arg">method</span>=<span class="summary-sig-default">"xml"</span>,
1852 <span class="summary-sig-arg">pretty_print</span>=<span class="summary-sig-default">False</span>,
1853 <span class="summary-sig-arg">with_tail</span>=<span class="summary-sig-default">True</span>,
1854 <span class="summary-sig-arg">doctype</span>=<span class="summary-sig-default">None</span>)</span><br />
1855 Serialize an element to the Python unicode representation of its XML
1857 <td align="right" valign="top">
1867 <td width="15%" align="right" valign="top" class="summary">
1868 <span class="summary-type"> </span>
1869 </td><td class="summary">
1870 <table width="100%" cellpadding="0" cellspacing="0" border="0">
1872 <td><span class="summary-sig"><a href="lxml.etree-module.html#use_global_python_log" class="summary-sig-name">use_global_python_log</a>(<span class="summary-sig-arg">log</span>)</span><br />
1873 Replace the global error log by an etree.PyErrorLog that uses the
1874 standard Python logging package.</td>
1875 <td align="right" valign="top">
1885 <!-- ==================== VARIABLES ==================== -->
1886 <a name="section-Variables"></a>
1887 <table class="summary" border="1" cellpadding="3"
1888 cellspacing="0" width="100%" bgcolor="white">
1889 <tr bgcolor="#70b0f0" class="table-header">
1890 <td colspan="2" class="table-header">
1891 <table border="0" cellpadding="0" cellspacing="0" width="100%">
1893 <td align="left"><span class="table-header">Variables</span></td>
1894 <td align="right" valign="top"
1895 ><span class="options">[<a href="#section-Variables"
1896 class="privatelink" onclick="toggle_private();"
1897 >hide private</a>]</span></td>
1903 <td width="15%" align="right" valign="top" class="summary">
1904 <span class="summary-type"> </span>
1905 </td><td class="summary">
1906 <a name="DEBUG"></a><span class="summary-name">DEBUG</span> = <code title="1">1</code>
1910 <td width="15%" align="right" valign="top" class="summary">
1911 <span class="summary-type"> </span>
1912 </td><td class="summary">
1913 <a name="LIBXML_COMPILED_VERSION"></a><span class="summary-name">LIBXML_COMPILED_VERSION</span> = <code title="(2, 7, 8)"><code class="variable-group">(</code>2<code class="variable-op">, </code>7<code class="variable-op">, </code>8<code class="variable-group">)</code></code>
1917 <td width="15%" align="right" valign="top" class="summary">
1918 <span class="summary-type"> </span>
1919 </td><td class="summary">
1920 <a name="LIBXML_VERSION"></a><span class="summary-name">LIBXML_VERSION</span> = <code title="(2, 7, 8)"><code class="variable-group">(</code>2<code class="variable-op">, </code>7<code class="variable-op">, </code>8<code class="variable-group">)</code></code>
1924 <td width="15%" align="right" valign="top" class="summary">
1925 <span class="summary-type"> </span>
1926 </td><td class="summary">
1927 <a name="LIBXSLT_COMPILED_VERSION"></a><span class="summary-name">LIBXSLT_COMPILED_VERSION</span> = <code title="(1, 1, 26)"><code class="variable-group">(</code>1<code class="variable-op">, </code>1<code class="variable-op">, </code>26<code class="variable-group">)</code></code>
1931 <td width="15%" align="right" valign="top" class="summary">
1932 <span class="summary-type"> </span>
1933 </td><td class="summary">
1934 <a name="LIBXSLT_VERSION"></a><span class="summary-name">LIBXSLT_VERSION</span> = <code title="(1, 1, 26)"><code class="variable-group">(</code>1<code class="variable-op">, </code>1<code class="variable-op">, </code>26<code class="variable-group">)</code></code>
1938 <td width="15%" align="right" valign="top" class="summary">
1939 <span class="summary-type"> </span>
1940 </td><td class="summary">
1941 <a name="LXML_VERSION"></a><span class="summary-name">LXML_VERSION</span> = <code title="(2, 3, 5, 0)"><code class="variable-group">(</code>2<code class="variable-op">, </code>3<code class="variable-op">, </code>5<code class="variable-op">, </code>0<code class="variable-group">)</code></code>
1944 <tr class="private">
1945 <td width="15%" align="right" valign="top" class="summary">
1946 <span class="summary-type"> </span>
1947 </td><td class="summary">
1948 <a name="__package__"></a><span class="summary-name">__package__</span> = <code title="'lxml'"><code class="variable-quote">'</code><code class="variable-string">lxml</code><code class="variable-quote">'</code></code>
1951 <tr class="private">
1952 <td width="15%" align="right" valign="top" class="summary">
1953 <span class="summary-type"> </span>
1954 </td><td class="summary">
1955 <a href="lxml.etree-module.html#__pyx_capi__" class="summary-name" onclick="show_private();">__pyx_capi__</a> = <code title="{'appendChild': <capsule object "void (struct LxmlElement *, struct Lx\
1956 mlElement *)" at 0x12a7d50>,
1957 'attributeValue': <capsule object "PyObject *(xmlNode *, xmlAttr *)" \
1959 'attributeValueFromNsName': <capsule object "PyObject *(xmlNode *, ch\
1960 ar *, char *)" at 0x12a7a50>,
1961 'callLookupFallback': <capsule object "PyObject *(struct LxmlFallback\
1962 ElementClassLookup *, struct LxmlDocument *, xmlNode *)" at 0x12a76f0>\
1963 ..."><code class="variable-group">{</code><code class="variable-quote">'</code><code class="variable-string">appendChild</code><code class="variable-quote">'</code><code class="variable-op">: </code><capsule object "void (struct L<code class="variable-ellipsis">...</code></code>
1966 <tr class="private">
1967 <td width="15%" align="right" valign="top" class="summary">
1968 <span class="summary-type"> </span>
1969 </td><td class="summary">
1970 <a href="lxml.etree-module.html#__test__" class="summary-name" onclick="show_private();">__test__</a> = <code title="{u'XML (line 2713)': u'''XML(text, parser=None, base_url=None)
1972 Parses an XML document or fragment from a string constant.
1973 Returns the root node (or the result returned by a parser target).
1974 This function can be used to embed "XML literals" in Python code,
1977 >>> root = etree.XML("<root><test/></root>")
1978 ..."><code class="variable-group">{</code><code class="variable-quote">u'</code><code class="variable-string">XML (line 2713)</code><code class="variable-quote">'</code><code class="variable-op">: </code><code class="variable-quote">u'</code><code class="variable-string">XML(text, parser=None, base_</code><code class="variable-ellipsis">...</code></code>
1982 <!-- ==================== FUNCTION DETAILS ==================== -->
1983 <a name="section-FunctionDetails"></a>
1984 <table class="details" border="1" cellpadding="3"
1985 cellspacing="0" width="100%" bgcolor="white">
1986 <tr bgcolor="#70b0f0" class="table-header">
1987 <td colspan="2" class="table-header">
1988 <table border="0" cellpadding="0" cellspacing="0" width="100%">
1990 <td align="left"><span class="table-header">Function Details</span></td>
1991 <td align="right" valign="top"
1992 ><span class="options">[<a href="#section-FunctionDetails"
1993 class="privatelink" onclick="toggle_private();"
1994 >hide private</a>]</span></td>
2000 <a name="Element"></a>
2002 <table class="details" border="1" cellpadding="3"
2003 cellspacing="0" width="100%" bgcolor="white">
2005 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2006 <tr valign="top"><td>
2007 <h3 class="epydoc"><span class="sig"><span class="sig-name">Element</span>(<span class="sig-arg">_tag</span>,
2008 <span class="sig-arg">attrib</span>=<span class="sig-default">None</span>,
2009 <span class="sig-arg">nsmap</span>=<span class="sig-default">None</span>,
2010 <span class="sig-arg">**_extra</span>)</span>
2012 </td><td align="right" valign="top"
2017 <p>Element factory. This function returns an object implementing the
2018 Element interface.</p>
2019 <p>Also look at the <a href="lxml.etree._Element-class.html#makeelement" class="link">_Element.makeelement()</a> and
2020 <a href="lxml.etree._BaseParser-class.html#makeelement" class="link">_BaseParser.makeelement()</a> methods, which provide a faster way to
2021 create an Element within a specific document or parser context.</p>
2026 <a name="Extension"></a>
2028 <table class="details" border="1" cellpadding="3"
2029 cellspacing="0" width="100%" bgcolor="white">
2031 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2032 <tr valign="top"><td>
2033 <h3 class="epydoc"><span class="sig"><span class="sig-name">Extension</span>(<span class="sig-arg">module</span>,
2034 <span class="sig-arg">function_mapping</span>=<span class="sig-default">None</span>,
2035 <span class="sig-arg">ns</span>=<span class="sig-default">None</span>)</span>
2037 </td><td align="right" valign="top"
2042 <p>Build a dictionary of extension functions from the functions
2043 defined in a module or the methods of an object.</p>
2044 <p>As second argument, you can pass an additional mapping of
2045 attribute names to XPath function names, or a list of function
2046 names that should be taken.</p>
2047 <p>The <tt class="rst-docutils literal">ns</tt> keyword argument accepts a namespace URI for the XPath
2053 <a name="FunctionNamespace"></a>
2055 <table class="details" border="1" cellpadding="3"
2056 cellspacing="0" width="100%" bgcolor="white">
2058 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2059 <tr valign="top"><td>
2060 <h3 class="epydoc"><span class="sig"><span class="sig-name">FunctionNamespace</span>(<span class="sig-arg">ns_uri</span>)</span>
2062 </td><td align="right" valign="top"
2067 <p>Retrieve the function namespace object associated with the given
2069 <p>Creates a new one if it does not yet exist. A function namespace
2070 can only be used to register extension functions.</p>
2077 <table class="details" border="1" cellpadding="3"
2078 cellspacing="0" width="100%" bgcolor="white">
2080 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2081 <tr valign="top"><td>
2082 <h3 class="epydoc"><span class="sig"><span class="sig-name">HTML</span>(<span class="sig-arg">text</span>,
2083 <span class="sig-arg">parser</span>=<span class="sig-default">None</span>,
2084 <span class="sig-arg">base_url</span>=<span class="sig-default">None</span>)</span>
2086 </td><td align="right" valign="top"
2091 <p>Parses an HTML document from a string constant. Returns the root
2092 node (or the result returned by a parser target). This function
2093 can be used to embed "HTML literals" in Python code.</p>
2094 <p>To override the parser with a different <tt class="rst-docutils literal">HTMLParser</tt> you can pass it to
2095 the <tt class="rst-docutils literal">parser</tt> keyword argument.</p>
2096 <p>The <tt class="rst-docutils literal">base_url</tt> keyword argument allows to set the original base URL of
2097 the document to support relative Paths when looking up external entities
2098 (DTD, XInclude, ...).</p>
2105 <table class="details" border="1" cellpadding="3"
2106 cellspacing="0" width="100%" bgcolor="white">
2108 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2109 <tr valign="top"><td>
2110 <h3 class="epydoc"><span class="sig"><span class="sig-name">XML</span>(<span class="sig-arg">text</span>,
2111 <span class="sig-arg">parser</span>=<span class="sig-default">None</span>,
2112 <span class="sig-arg">base_url</span>=<span class="sig-default">None</span>)</span>
2114 </td><td align="right" valign="top"
2119 <p>Parses an XML document or fragment from a string constant.
2120 Returns the root node (or the result returned by a parser target).
2121 This function can be used to embed "XML literals" in Python code,
2124 <pre class="py-doctest">
2125 <span class="py-prompt">>>> </span>root = etree.XML(<span class="py-string">"<root><test/></root>"</span>)</pre>
2127 <p>To override the parser with a different <tt class="rst-docutils literal">XMLParser</tt> you can pass it to
2128 the <tt class="rst-docutils literal">parser</tt> keyword argument.</p>
2129 <p>The <tt class="rst-docutils literal">base_url</tt> keyword argument allows to set the original base URL of
2130 the document to support relative Paths when looking up external entities
2131 (DTD, XInclude, ...).</p>
2136 <a name="XMLDTDID"></a>
2138 <table class="details" border="1" cellpadding="3"
2139 cellspacing="0" width="100%" bgcolor="white">
2141 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2142 <tr valign="top"><td>
2143 <h3 class="epydoc"><span class="sig"><span class="sig-name">XMLDTDID</span>(<span class="sig-arg">text</span>,
2144 <span class="sig-arg">parser</span>=<span class="sig-default">None</span>,
2145 <span class="sig-arg">base_url</span>=<span class="sig-default">None</span>)</span>
2147 </td><td align="right" valign="top"
2152 <p>Parse the text and return a tuple (root node, ID dictionary). The root
2153 node is the same as returned by the XML() function. The dictionary
2154 contains string-element pairs. The dictionary keys are the values of ID
2155 attributes as defined by the DTD. The elements referenced by the ID are
2156 stored as dictionary values.</p>
2157 <p>Note that you must not modify the XML tree if you use the ID dictionary.
2158 The results are undefined.</p>
2163 <a name="XPathEvaluator"></a>
2165 <table class="details" border="1" cellpadding="3"
2166 cellspacing="0" width="100%" bgcolor="white">
2168 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2169 <tr valign="top"><td>
2170 <h3 class="epydoc"><span class="sig"><span class="sig-name">XPathEvaluator</span>(<span class="sig-arg">etree_or_element</span>,
2171 <span class="sig-arg">namespaces</span>=<span class="sig-default">None</span>,
2172 <span class="sig-arg">extensions</span>=<span class="sig-default">None</span>,
2173 <span class="sig-arg">regexp</span>=<span class="sig-default">True</span>,
2174 <span class="sig-arg">smart_strings</span>=<span class="sig-default">True</span>)</span>
2176 </td><td align="right" valign="top"
2181 <p>Creates an XPath evaluator for an ElementTree or an Element.</p>
2182 <p>The resulting object can be called with an XPath expression as argument
2183 and XPath variables provided as keyword arguments.</p>
2184 <p>Additional namespace declarations can be passed with the
2185 'namespace' keyword argument. EXSLT regular expression support
2186 can be disabled with the 'regexp' boolean keyword (defaults to
2187 True). Smart strings will be returned for string results unless
2188 you pass <tt class="rst-docutils literal">smart_strings=False</tt>.</p>
2193 <a name="clear_error_log"></a>
2195 <table class="details" border="1" cellpadding="3"
2196 cellspacing="0" width="100%" bgcolor="white">
2198 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2199 <tr valign="top"><td>
2200 <h3 class="epydoc"><span class="sig"><span class="sig-name">clear_error_log</span>()</span>
2202 </td><td align="right" valign="top"
2207 <p>Clear the global error log. Note that this log is already bound to a
2209 <p>Note: since lxml 2.2, the global error log is local to a thread
2210 and this function will only clear the global error log of the
2216 <a name="fromstring"></a>
2218 <table class="details" border="1" cellpadding="3"
2219 cellspacing="0" width="100%" bgcolor="white">
2221 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2222 <tr valign="top"><td>
2223 <h3 class="epydoc"><span class="sig"><span class="sig-name">fromstring</span>(<span class="sig-arg">text</span>,
2224 <span class="sig-arg">parser</span>=<span class="sig-default">None</span>,
2225 <span class="sig-arg">base_url</span>=<span class="sig-default">None</span>)</span>
2227 </td><td align="right" valign="top"
2232 <p>Parses an XML document or fragment from a string. Returns the
2233 root node (or the result returned by a parser target).</p>
2234 <p>To override the default parser with a different parser you can pass it to
2235 the <tt class="rst-docutils literal">parser</tt> keyword argument.</p>
2236 <p>The <tt class="rst-docutils literal">base_url</tt> keyword argument allows to set the original base URL of
2237 the document to support relative Paths when looking up external entities
2238 (DTD, XInclude, ...).</p>
2243 <a name="fromstringlist"></a>
2245 <table class="details" border="1" cellpadding="3"
2246 cellspacing="0" width="100%" bgcolor="white">
2248 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2249 <tr valign="top"><td>
2250 <h3 class="epydoc"><span class="sig"><span class="sig-name">fromstringlist</span>(<span class="sig-arg">strings</span>,
2251 <span class="sig-arg">parser</span>=<span class="sig-default">None</span>)</span>
2253 </td><td align="right" valign="top"
2258 <p>Parses an XML document from a sequence of strings. Returns the
2259 root node (or the result returned by a parser target).</p>
2260 <p>To override the default parser with a different parser you can pass it to
2261 the <tt class="rst-docutils literal">parser</tt> keyword argument.</p>
2266 <a name="parse"></a>
2268 <table class="details" border="1" cellpadding="3"
2269 cellspacing="0" width="100%" bgcolor="white">
2271 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2272 <tr valign="top"><td>
2273 <h3 class="epydoc"><span class="sig"><span class="sig-name">parse</span>(<span class="sig-arg">source</span>,
2274 <span class="sig-arg">parser</span>=<span class="sig-default">None</span>,
2275 <span class="sig-arg">base_url</span>=<span class="sig-default">None</span>)</span>
2277 </td><td align="right" valign="top"
2282 <p>Return an ElementTree object loaded with source elements. If no parser
2283 is provided as second argument, the default parser is used.</p>
2284 <p>The <tt class="rst-docutils literal">source</tt> can be any of the following:</p>
2285 <ul class="rst-simple">
2286 <li>a file name/path</li>
2287 <li>a file object</li>
2288 <li>a file-like object</li>
2289 <li>a URL using the HTTP or FTP protocol</li>
2291 <p>To parse from a string, use the <tt class="rst-docutils literal">fromstring()</tt> function instead.</p>
2292 <p>Note that it is generally faster to parse from a file path or URL
2293 than from an open file object or file-like object. Transparent
2294 decompression from gzip compressed sources is supported (unless
2295 explicitly disabled in libxml2).</p>
2296 <p>The <tt class="rst-docutils literal">base_url</tt> keyword allows setting a URL for the document
2297 when parsing from a file-like object. This is needed when looking
2298 up external entities (DTD, XInclude, ...) with relative paths.</p>
2303 <a name="parseid"></a>
2305 <table class="details" border="1" cellpadding="3"
2306 cellspacing="0" width="100%" bgcolor="white">
2308 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2309 <tr valign="top"><td>
2310 <h3 class="epydoc"><span class="sig"><span class="sig-name">parseid</span>(<span class="sig-arg">source</span>,
2311 <span class="sig-arg">parser</span>=<span class="sig-default">None</span>)</span>
2313 </td><td align="right" valign="top"
2318 <p>Parses the source into a tuple containing an ElementTree object and an
2319 ID dictionary. If no parser is provided as second argument, the default
2321 <p>Note that you must not modify the XML tree if you use the ID dictionary.
2322 The results are undefined.</p>
2327 <a name="set_default_parser"></a>
2329 <table class="details" border="1" cellpadding="3"
2330 cellspacing="0" width="100%" bgcolor="white">
2332 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2333 <tr valign="top"><td>
2334 <h3 class="epydoc"><span class="sig"><span class="sig-name">set_default_parser</span>(<span class="sig-arg">parser</span>=<span class="sig-default">None</span>)</span>
2336 </td><td align="right" valign="top"
2341 <p>Set a default parser for the current thread. This parser is used
2342 globally whenever no parser is supplied to the various parse functions of
2343 the lxml API. If this function is called without a parser (or if it is
2344 None), the default parser is reset to the original configuration.</p>
2345 <p>Note that the pre-installed default parser is not thread-safe. Avoid the
2346 default parser in multi-threaded environments. You can create a separate
2347 parser for each thread explicitly or use a parser pool.</p>
2352 <a name="strip_attributes"></a>
2354 <table class="details" border="1" cellpadding="3"
2355 cellspacing="0" width="100%" bgcolor="white">
2357 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2358 <tr valign="top"><td>
2359 <h3 class="epydoc"><span class="sig"><span class="sig-name">strip_attributes</span>(<span class="sig-arg">tree_or_element</span>,
2360 <span class="sig-arg">*attribute_names</span>)</span>
2362 </td><td align="right" valign="top"
2367 <p>Delete all attributes with the provided attribute names from an
2368 Element (or ElementTree) and its descendants.</p>
2369 <p>Example usage:</p>
2370 <pre class="rst-literal-block">
2371 strip_attributes(root_element,
2373 '{http://some/ns}attrname')
2379 <a name="strip_elements"></a>
2381 <table class="details" border="1" cellpadding="3"
2382 cellspacing="0" width="100%" bgcolor="white">
2384 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2385 <tr valign="top"><td>
2386 <h3 class="epydoc"><span class="sig"><span class="sig-name">strip_elements</span>(<span class="sig-arg">tree_or_element</span>,
2387 <span class="sig-arg">with_tail</span>=<span class="sig-default">True</span>,
2388 <span class="sig-arg">*tag_names</span>)</span>
2390 </td><td align="right" valign="top"
2395 <p>Delete all elements with the provided tag names from a tree or
2396 subtree. This will remove the elements and their entire subtree,
2397 including all their attributes, text content and descendants. It
2398 will also remove the tail text of the element unless you
2399 explicitly set the <tt class="rst-rst-docutils literal rst-docutils literal">with_tail</tt> keyword argument option to False.</p>
2400 <p>Note that this will not delete the element (or ElementTree root
2401 element) that you passed even if it matches. It will only treat
2402 its descendants. If you want to include the root element, check
2403 its tag name directly before even calling this function.</p>
2404 <p>Example usage:</p>
2405 <pre class="rst-literal-block">
2406 strip_elements(some_element,
2407 'simpletagname', # non-namespaced tag
2408 '{http://some/ns}tagname', # namespaced tag
2409 '{http://some/other/ns}*' # any tag from a namespace
2410 lxml.etree.Comment # comments
2417 <a name="strip_tags"></a>
2419 <table class="details" border="1" cellpadding="3"
2420 cellspacing="0" width="100%" bgcolor="white">
2422 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2423 <tr valign="top"><td>
2424 <h3 class="epydoc"><span class="sig"><span class="sig-name">strip_tags</span>(<span class="sig-arg">tree_or_element</span>,
2425 <span class="sig-arg">*tag_names</span>)</span>
2427 </td><td align="right" valign="top"
2432 <p>Delete all elements with the provided tag names from a tree or
2433 subtree. This will remove the elements and their attributes, but
2434 <em>not</em> their text/tail content or descendants. Instead, it will
2435 merge the text content and children of the element into its
2437 <p>Note that this will not delete the element (or ElementTree root
2438 element) that you passed even if it matches. It will only treat
2439 its descendants.</p>
2440 <p>Example usage:</p>
2441 <pre class="rst-literal-block">
2442 strip_tags(some_element,
2443 'simpletagname', # non-namespaced tag
2444 '{http://some/ns}tagname', # namespaced tag
2445 '{http://some/other/ns}*' # any tag from a namespace
2446 Comment # comments (including their text!)
2453 <a name="tostring"></a>
2455 <table class="details" border="1" cellpadding="3"
2456 cellspacing="0" width="100%" bgcolor="white">
2458 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2459 <tr valign="top"><td>
2460 <h3 class="epydoc"><span class="sig"><span class="sig-name">tostring</span>(<span class="sig-arg">element_or_tree</span>,
2461 <span class="sig-arg">encoding</span>=<span class="sig-default">None</span>,
2462 <span class="sig-arg">method</span>=<span class="sig-default">"xml"</span>,
2463 <span class="sig-arg">xml_declaration</span>=<span class="sig-default">None</span>,
2464 <span class="sig-arg">pretty_print</span>=<span class="sig-default">False</span>,
2465 <span class="sig-arg">with_tail</span>=<span class="sig-default">True</span>,
2466 <span class="sig-arg">standalone</span>=<span class="sig-default">None</span>,
2467 <span class="sig-arg">doctype</span>=<span class="sig-default">None</span>,
2468 <span class="sig-arg">exclusive</span>=<span class="sig-default">False</span>,
2469 <span class="sig-arg">with_comments</span>=<span class="sig-default">True</span>)</span>
2471 </td><td align="right" valign="top"
2476 <p>Serialize an element to an encoded string representation of its XML
2478 <p>Defaults to ASCII encoding without XML declaration. This
2479 behaviour can be configured with the keyword arguments 'encoding'
2480 (string) and 'xml_declaration' (bool). Note that changing the
2481 encoding to a non UTF-8 compatible encoding will enable a
2482 declaration by default.</p>
2483 <p>You can also serialise to a Unicode string without declaration by
2484 passing the <tt class="rst-docutils literal">unicode</tt> function as encoding (or <tt class="rst-docutils literal">str</tt> in Py3),
2485 or the name 'unicode'. This changes the return value from a byte
2486 string to an unencoded unicode string.</p>
2487 <p>The keyword argument 'pretty_print' (bool) enables formatted XML.</p>
2488 <p>The keyword argument 'method' selects the output method: 'xml',
2489 'html', plain 'text' (text content without tags) or 'c14n'.
2490 Default is 'xml'.</p>
2491 <p>The <tt class="rst-docutils literal">exclusive</tt> and <tt class="rst-docutils literal">with_comments</tt> arguments are only used
2492 with C14N output, where they request exclusive and uncommented
2493 C14N serialisation respectively.</p>
2494 <p>Passing a boolean value to the <tt class="rst-docutils literal">standalone</tt> option will output
2495 an XML declaration with the corresponding <tt class="rst-docutils literal">standalone</tt> flag.</p>
2496 <p>The <tt class="rst-docutils literal">doctype</tt> option allows passing in a plain string that will
2497 be serialised before the XML tree. Note that passing in non
2498 well-formed content here will make the XML output non well-formed.
2499 Also, an existing doctype in the document tree will not be removed
2500 when serialising an ElementTree instance.</p>
2501 <p>You can prevent the tail text of the element from being serialised
2502 by passing the boolean <tt class="rst-docutils literal">with_tail</tt> option. This has no impact
2503 on the tail text of children, which will always be serialised.</p>
2508 <a name="tostringlist"></a>
2510 <table class="details" border="1" cellpadding="3"
2511 cellspacing="0" width="100%" bgcolor="white">
2513 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2514 <tr valign="top"><td>
2515 <h3 class="epydoc"><span class="sig"><span class="sig-name">tostringlist</span>(<span class="sig-arg">element_or_tree</span>,
2516 <span class="sig-arg">*args</span>,
2517 <span class="sig-arg">**kwargs</span>)</span>
2519 </td><td align="right" valign="top"
2524 <p>Serialize an element to an encoded string representation of its XML
2525 tree, stored in a list of partial strings.</p>
2526 <p>This is purely for ElementTree 1.3 compatibility. The result is a
2527 single string wrapped in a list.</p>
2532 <a name="tounicode"></a>
2534 <table class="details" border="1" cellpadding="3"
2535 cellspacing="0" width="100%" bgcolor="white">
2537 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2538 <tr valign="top"><td>
2539 <h3 class="epydoc"><span class="sig"><span class="sig-name">tounicode</span>(<span class="sig-arg">element_or_tree</span>,
2540 <span class="sig-arg">method</span>=<span class="sig-default">"xml"</span>,
2541 <span class="sig-arg">pretty_print</span>=<span class="sig-default">False</span>,
2542 <span class="sig-arg">with_tail</span>=<span class="sig-default">True</span>,
2543 <span class="sig-arg">doctype</span>=<span class="sig-default">None</span>)</span>
2545 </td><td align="right" valign="top"
2550 <p>Serialize an element to the Python unicode representation of its XML
2552 <p>Note that the result does not carry an XML encoding declaration and is
2553 therefore not necessarily suited for serialization to byte streams without
2554 further treatment.</p>
2555 <p>The boolean keyword argument 'pretty_print' enables formatted XML.</p>
2556 <p>The keyword argument 'method' selects the output method: 'xml',
2557 'html' or plain 'text'.</p>
2558 <p>You can prevent the tail text of the element from being serialised
2559 by passing the boolean <tt class="rst-docutils literal">with_tail</tt> option. This has no impact
2560 on the tail text of children, which will always be serialised.</p>
2563 <div class="fields"> <p><strong>Deprecated:</strong>
2564 use <tt class="rst-rst-docutils literal rst-docutils literal">tostring(el, encoding=unicode)</tt> instead.
2566 </div></td></tr></table>
2568 <a name="use_global_python_log"></a>
2570 <table class="details" border="1" cellpadding="3"
2571 cellspacing="0" width="100%" bgcolor="white">
2573 <table width="100%" cellpadding="0" cellspacing="0" border="0">
2574 <tr valign="top"><td>
2575 <h3 class="epydoc"><span class="sig"><span class="sig-name">use_global_python_log</span>(<span class="sig-arg">log</span>)</span>
2577 </td><td align="right" valign="top"
2582 <p>Replace the global error log by an etree.PyErrorLog that uses the
2583 standard Python logging package.</p>
2584 <p>Note that this disables access to the global error log from exceptions.
2585 Parsers, XSLT etc. will continue to provide their normal local error log.</p>
2586 <p>Note: prior to lxml 2.2, this changed the error log globally.
2587 Since lxml 2.2, the global error log is local to a thread and this
2588 function will only set the global error log of the current thread.</p>
2594 <!-- ==================== VARIABLES DETAILS ==================== -->
2595 <a name="section-VariablesDetails"></a>
2596 <table class="details" border="1" cellpadding="3"
2597 cellspacing="0" width="100%" bgcolor="white">
2598 <tr bgcolor="#70b0f0" class="table-header">
2599 <td colspan="2" class="table-header">
2600 <table border="0" cellpadding="0" cellspacing="0" width="100%">
2602 <td align="left"><span class="table-header">Variables Details</span></td>
2603 <td align="right" valign="top"
2604 ><span class="options">[<a href="#section-VariablesDetails"
2605 class="privatelink" onclick="toggle_private();"
2606 >hide private</a>]</span></td>
2612 <a name="__pyx_capi__"></a>
2613 <div class="private">
2614 <table class="details" border="1" cellpadding="3"
2615 cellspacing="0" width="100%" bgcolor="white">
2617 <h3 class="epydoc">__pyx_capi__</h3>
2623 <dd><table><tr><td><pre class="variable">
2624 <code class="variable-group">{</code><code class="variable-quote">'</code><code class="variable-string">appendChild</code><code class="variable-quote">'</code><code class="variable-op">: </code><capsule object "void (struct LxmlElement *, struct Lx<span class="variable-linewrap"><img src="crarr.png" alt="\" /></span>
2625 mlElement *)" at 0x12a7d50><code class="variable-op">,</code>
2626 <code class="variable-quote">'</code><code class="variable-string">attributeValue</code><code class="variable-quote">'</code><code class="variable-op">: </code><capsule object "PyObject *(xmlNode *, xmlAttr *)" <span class="variable-linewrap"><img src="crarr.png" alt="\" /></span>
2627 at 0x12a7a20><code class="variable-op">,</code>
2628 <code class="variable-quote">'</code><code class="variable-string">attributeValueFromNsName</code><code class="variable-quote">'</code><code class="variable-op">: </code><capsule object "PyObject *(xmlNode *, ch<span class="variable-linewrap"><img src="crarr.png" alt="\" /></span>
2629 ar *, char *)" at 0x12a7a50><code class="variable-op">,</code>
2630 <code class="variable-quote">'</code><code class="variable-string">callLookupFallback</code><code class="variable-quote">'</code><code class="variable-op">: </code><capsule object "PyObject *(struct LxmlFallback<span class="variable-linewrap"><img src="crarr.png" alt="\" /></span>
2631 ElementClassLookup *, struct LxmlDocument *, xmlNode *)" at 0x12a76f0><code class="variable-op"></code><span class="variable-linewrap"><img src="crarr.png" alt="\" /></span>
2632 <code class="variable-ellipsis">...</code>
2633 </pre></td></tr></table>
2638 <a name="__test__"></a>
2639 <div class="private">
2640 <table class="details" border="1" cellpadding="3"
2641 cellspacing="0" width="100%" bgcolor="white">
2643 <h3 class="epydoc">__test__</h3>
2649 <dd><table><tr><td><pre class="variable">
2650 <code class="variable-group">{</code><code class="variable-quote">u'</code><code class="variable-string">XML (line 2713)</code><code class="variable-quote">'</code><code class="variable-op">: </code><code class="variable-quote">u'''</code><code class="variable-string">XML(text, parser=None, base_url=None)</code>
2651 <code class="variable-string"></code>
2652 <code class="variable-string"> Parses an XML document or fragment from a string constant.</code>
2653 <code class="variable-string"> Returns the root node (or the result returned by a parser target).</code>
2654 <code class="variable-string"> This function can be used to embed "XML literals" in Python code,</code>
2655 <code class="variable-string"> like in</code>
2656 <code class="variable-string"></code>
2657 <code class="variable-string"> >>> root = etree.XML("<root><test/></root>")</code>
2658 <code class="variable-ellipsis">...</code>
2659 </pre></td></tr></table>
2665 <!-- ==================== NAVIGATION BAR ==================== -->
2666 <table class="navbar" border="0" width="100%" cellpadding="0"
2667 bgcolor="#a0c0ff" cellspacing="0">
2668 <tr valign="middle">
2670 <th> <a
2671 href="lxml-module.html">Home</a> </th>
2674 <th> <a
2675 href="module-tree.html">Trees</a> </th>
2678 <th> <a
2679 href="identifier-index.html">Indices</a> </th>
2682 <th> <a
2683 href="help.html">Help</a> </th>
2685 <!-- Project homepage -->
2686 <th class="navbar" align="right" width="100%">
2687 <table border="0" cellpadding="0" cellspacing="0">
2688 <tr><th class="navbar" align="center"
2689 ><a class="navbar" target="_top" href="/">lxml API</a></th>
2693 <table border="0" cellpadding="0" cellspacing="0" width="100%%">
2695 <td align="left" class="footer">
2696 Generated by Epydoc 3.0.1 on Tue Jul 31 10:14:17 2012
2698 <td align="right" class="footer">
2699 <a target="mainFrame" href="http://epydoc.sourceforge.net"
2700 >http://epydoc.sourceforge.net</a>
2705 <script type="text/javascript">
2707 // Private objects are initially displayed (because if
2708 // javascript is turned off then we want them to be
2709 // visible); but by default, we want to hide them. So hide
2710 // them unless we have a cookie that says to show them.