Imported Upstream version 2.3.5
[platform/upstream/python-lxml.git] / doc / html / api / lxml.sax-pysrc.html
1 <?xml version="1.0" encoding="ascii"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3           "DTD/xhtml1-transitional.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5 <head>
6   <title>lxml.sax</title>
7   <link rel="stylesheet" href="epydoc.css" type="text/css" />
8   <script type="text/javascript" src="epydoc.js"></script>
9 </head>
10
11 <body bgcolor="white" text="black" link="blue" vlink="#204080"
12       alink="#204080">
13 <!-- ==================== NAVIGATION BAR ==================== -->
14 <table class="navbar" border="0" width="100%" cellpadding="0"
15        bgcolor="#a0c0ff" cellspacing="0">
16   <tr valign="middle">
17   <!-- Home link -->
18       <th>&nbsp;&nbsp;&nbsp;<a
19         href="lxml-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
20
21   <!-- Tree link -->
22       <th>&nbsp;&nbsp;&nbsp;<a
23         href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
24
25   <!-- Index link -->
26       <th>&nbsp;&nbsp;&nbsp;<a
27         href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
28
29   <!-- Help link -->
30       <th>&nbsp;&nbsp;&nbsp;<a
31         href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
32
33   <!-- Project homepage -->
34       <th class="navbar" align="right" width="100%">
35         <table border="0" cellpadding="0" cellspacing="0">
36           <tr><th class="navbar" align="center"
37             ><a class="navbar" target="_top" href="/">lxml API</a></th>
38           </tr></table></th>
39   </tr>
40 </table>
41 <table width="100%" cellpadding="0" cellspacing="0">
42   <tr valign="top">
43     <td width="100%">
44       <span class="breadcrumbs">
45         <a href="lxml-module.html">Package&nbsp;lxml</a> ::
46         Module&nbsp;sax
47       </span>
48     </td>
49     <td>
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&nbsp;private</a>]</span></td></tr>
54         <tr><td align="right"><span class="options"
55             >[<a href="frames.html" target="_top">frames</a
56             >]&nbsp;|&nbsp;<a href="lxml.sax-pysrc.html"
57             target="_top">no&nbsp;frames</a>]</span></td></tr>
58       </table>
59     </td>
60   </tr>
61 </table>
62 <h1 class="epydoc">Source Code for <a href="lxml.sax-module.html">Module lxml.sax</a></h1>
63 <pre class="py-src">
64 <a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
65 <a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-docstring">SAX-based adapter to copy trees from/to the Python standard library.</tt> </tt>
66 <a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
67 <a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-docstring">Use the `ElementTreeContentHandler` class to build an ElementTree from</tt> </tt>
68 <a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-docstring">SAX events.</tt> </tt>
69 <a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
70 <a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-docstring">Use the `ElementTreeProducer` class or the `saxify()` function to fire</tt> </tt>
71 <a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-docstring">the SAX events of an ElementTree against a SAX ContentHandler.</tt> </tt>
72 <a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
73 <a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-docstring">See http://codespeak.net/lxml/sax.html</tt> </tt>
74 <a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
75 <a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"> </tt>
76 <a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-0" class="py-name" targets="Variable lxml.tests.test_threading.ThreadPipelineTestCase.xml=lxml.tests.test_threading.ThreadPipelineTestCase-class.html#xml"><a title="lxml.tests.test_threading.ThreadPipelineTestCase.xml" class="py-name" href="#" onclick="return doclink('link-0', 'xml', 'link-0');">xml</a></tt><tt class="py-op">.</tt><tt id="link-1" class="py-name" targets="Module lxml.sax=lxml.sax-module.html"><a title="lxml.sax" class="py-name" href="#" onclick="return doclink('link-1', 'sax', 'link-1');">sax</a></tt><tt class="py-op">.</tt><tt class="py-name">handler</tt> <tt class="py-keyword">import</tt> <tt class="py-name">ContentHandler</tt> </tt>
77 <a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-2" class="py-name" targets="Package lxml=lxml-module.html"><a title="lxml" class="py-name" href="#" onclick="return doclink('link-2', 'lxml', 'link-2');">lxml</a></tt> <tt class="py-keyword">import</tt> <tt id="link-3" class="py-name" targets="Module lxml.etree=lxml.etree-module.html,Variable lxml.sax.ElementTreeContentHandler.etree=lxml.sax.ElementTreeContentHandler-class.html#etree,Variable lxml.tests.test_elementtree.CElementTreeTestCase.etree=lxml.tests.test_elementtree.CElementTreeTestCase-class.html#etree,Variable lxml.tests.test_elementtree.ETreeTestCaseBase.etree=lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#etree,Variable lxml.tests.test_io.IOTestCaseBase.etree=lxml.tests.test_io.IOTestCaseBase-class.html#etree"><a title="lxml.etree
78 lxml.sax.ElementTreeContentHandler.etree
79 lxml.tests.test_elementtree.CElementTreeTestCase.etree
80 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
81 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-3', 'etree', 'link-3');">etree</a></tt> </tt>
82 <a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-4" class="py-name"><a title="lxml" class="py-name" href="#" onclick="return doclink('link-4', 'lxml', 'link-2');">lxml</a></tt><tt class="py-op">.</tt><tt id="link-5" class="py-name"><a title="lxml.etree
83 lxml.sax.ElementTreeContentHandler.etree
84 lxml.tests.test_elementtree.CElementTreeTestCase.etree
85 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
86 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-5', 'etree', 'link-3');">etree</a></tt> <tt class="py-keyword">import</tt> <tt id="link-6" class="py-name" targets="Function lxml.etree.ElementTree()=lxml.etree-module.html#ElementTree,Module xml.etree.ElementTree=xml.etree.ElementTree-module.html,Class xml.etree.ElementTree.ElementTree=xml.etree.ElementTree.ElementTree-class.html"><a title="lxml.etree.ElementTree
87 xml.etree.ElementTree
88 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-6', 'ElementTree', 'link-6');">ElementTree</a></tt><tt class="py-op">,</tt> <tt id="link-7" class="py-name" targets="Function lxml.etree.SubElement()=lxml.etree-module.html#SubElement"><a title="lxml.etree.SubElement" class="py-name" href="#" onclick="return doclink('link-7', 'SubElement', 'link-7');">SubElement</a></tt> </tt>
89 <a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-8" class="py-name"><a title="lxml" class="py-name" href="#" onclick="return doclink('link-8', 'lxml', 'link-2');">lxml</a></tt><tt class="py-op">.</tt><tt id="link-9" class="py-name"><a title="lxml.etree
90 lxml.sax.ElementTreeContentHandler.etree
91 lxml.tests.test_elementtree.CElementTreeTestCase.etree
92 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
93 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-9', 'etree', 'link-3');">etree</a></tt> <tt class="py-keyword">import</tt> <tt id="link-10" class="py-name" targets="Function lxml.etree.Comment()=lxml.etree-module.html#Comment"><a title="lxml.etree.Comment" class="py-name" href="#" onclick="return doclink('link-10', 'Comment', 'link-10');">Comment</a></tt><tt class="py-op">,</tt> <tt class="py-name">ProcessingInstruction</tt> </tt>
94 <a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"> </tt>
95 <a name="SaxError"></a><div id="SaxError-def"><a name="L18"></a><tt class="py-lineno"> 18</tt> <a class="py-toggle" href="#" id="SaxError-toggle" onclick="return toggle('SaxError');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lxml.sax.SaxError-class.html">SaxError</a><tt class="py-op">(</tt><tt class="py-base-class">etree</tt><tt class="py-op">.</tt><tt class="py-base-class">LxmlError</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
96 </div><div id="SaxError-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="SaxError-expanded"><a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line">    <tt class="py-docstring">"""General SAX error.</tt> </tt>
97 <a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
98 <a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
99 </div><a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"> </tt>
100 <a name="_getNsTag"></a><div id="_getNsTag-def"><a name="L23"></a><tt class="py-lineno"> 23</tt> <a class="py-toggle" href="#" id="_getNsTag-toggle" onclick="return toggle('_getNsTag');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax-module.html#_getNsTag">_getNsTag</a><tt class="py-op">(</tt><tt class="py-param">tag</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
101 </div><div id="_getNsTag-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_getNsTag-expanded"><a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt id="link-11" class="py-name" targets="Variable lxml.etree._Comment.tag=lxml.etree._Comment-class.html#tag,Variable lxml.etree._Element.tag=lxml.etree._Element-class.html#tag,Variable lxml.etree._Entity.tag=lxml.etree._Entity-class.html#tag,Variable lxml.etree._ProcessingInstruction.tag=lxml.etree._ProcessingInstruction-class.html#tag,Variable lxml.etree._ReadOnlyProxy.tag=lxml.etree._ReadOnlyProxy-class.html#tag,Function lxml.tests.test_xpathevaluator.tag()=lxml.tests.test_xpathevaluator-module.html#tag,Variable xml.etree.ElementTree.Element.tag=xml.etree.ElementTree.Element-class.html#tag"><a title="lxml.etree._Comment.tag
102 lxml.etree._Element.tag
103 lxml.etree._Entity.tag
104 lxml.etree._ProcessingInstruction.tag
105 lxml.etree._ReadOnlyProxy.tag
106 lxml.tests.test_xpathevaluator.tag
107 xml.etree.ElementTree.Element.tag" class="py-name" href="#" onclick="return doclink('link-11', 'tag', 'link-11');">tag</a></tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">==</tt> <tt class="py-string">'{'</tt><tt class="py-op">:</tt> </tt>
108 <a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">tuple</tt><tt class="py-op">(</tt><tt id="link-12" class="py-name"><a title="lxml.etree._Comment.tag
109 lxml.etree._Element.tag
110 lxml.etree._Entity.tag
111 lxml.etree._ProcessingInstruction.tag
112 lxml.etree._ReadOnlyProxy.tag
113 lxml.tests.test_xpathevaluator.tag
114 xml.etree.ElementTree.Element.tag" class="py-name" href="#" onclick="return doclink('link-12', 'tag', 'link-11');">tag</a></tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-string">'}'</tt><tt class="py-op">,</tt> <tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
115 <a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
116 <a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-op">(</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt id="link-13" class="py-name"><a title="lxml.etree._Comment.tag
117 lxml.etree._Element.tag
118 lxml.etree._Entity.tag
119 lxml.etree._ProcessingInstruction.tag
120 lxml.etree._ReadOnlyProxy.tag
121 lxml.tests.test_xpathevaluator.tag
122 xml.etree.ElementTree.Element.tag" class="py-name" href="#" onclick="return doclink('link-13', 'tag', 'link-11');">tag</a></tt><tt class="py-op">)</tt> </tt>
123 </div><a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"> </tt>
124 <a name="ElementTreeContentHandler"></a><div id="ElementTreeContentHandler-def"><a name="L29"></a><tt class="py-lineno"> 29</tt> <a class="py-toggle" href="#" id="ElementTreeContentHandler-toggle" onclick="return toggle('ElementTreeContentHandler');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lxml.sax.ElementTreeContentHandler-class.html">ElementTreeContentHandler</a><tt class="py-op">(</tt><tt class="py-base-class">ContentHandler</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
125 </div><div id="ElementTreeContentHandler-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="ElementTreeContentHandler-expanded"><a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line">    <tt class="py-docstring">"""Build an lxml ElementTree from SAX events.</tt> </tt>
126 <a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
127 <a name="ElementTreeContentHandler.__init__"></a><div id="ElementTreeContentHandler.__init__-def"><a name="L32"></a><tt class="py-lineno"> 32</tt> <a class="py-toggle" href="#" id="ElementTreeContentHandler.__init__-toggle" onclick="return toggle('ElementTreeContentHandler.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax.ElementTreeContentHandler-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">makeelement</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
128 </div><div id="ElementTreeContentHandler.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeContentHandler.__init__-expanded"><a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_root</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
129 <a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_root_siblings</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
130 <a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_element_stack</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
131 <a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_default_ns</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
132 <a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_ns_mapping</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt> <tt class="py-name">None</tt> <tt class="py-op">:</tt> <tt class="py-op">[</tt><tt class="py-name">None</tt><tt class="py-op">]</tt> <tt class="py-op">}</tt> </tt>
133 <a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_new_mappings</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
134 <a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-14" class="py-name" targets="Method lxml.etree._BaseParser.makeelement()=lxml.etree._BaseParser-class.html#makeelement,Method lxml.etree._Element.makeelement()=lxml.etree._Element-class.html#makeelement"><a title="lxml.etree._BaseParser.makeelement
135 lxml.etree._Element.makeelement" class="py-name" href="#" onclick="return doclink('link-14', 'makeelement', 'link-14');">makeelement</a></tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
136 <a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line">            <tt id="link-15" class="py-name"><a title="lxml.etree._BaseParser.makeelement
137 lxml.etree._Element.makeelement" class="py-name" href="#" onclick="return doclink('link-15', 'makeelement', 'link-14');">makeelement</a></tt> <tt class="py-op">=</tt> <tt id="link-16" class="py-name"><a title="lxml.etree
138 lxml.sax.ElementTreeContentHandler.etree
139 lxml.tests.test_elementtree.CElementTreeTestCase.etree
140 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
141 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-16', 'etree', 'link-3');">etree</a></tt><tt class="py-op">.</tt><tt id="link-17" class="py-name" targets="Class lxml.cssselect.Element=lxml.cssselect.Element-class.html,Function lxml.etree.Element()=lxml.etree-module.html#Element,Function lxml.html.Element()=lxml.html-module.html#Element,Function lxml.objectify.Element()=lxml.objectify-module.html#Element,Method lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element()=lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#Element,Class xml.etree.ElementTree.Element=xml.etree.ElementTree.Element-class.html"><a title="lxml.cssselect.Element
142 lxml.etree.Element
143 lxml.html.Element
144 lxml.objectify.Element
145 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
146 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-17', 'Element', 'link-17');">Element</a></tt> </tt>
147 <a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_makeelement</tt> <tt class="py-op">=</tt> <tt id="link-18" class="py-name"><a title="lxml.etree._BaseParser.makeelement
148 lxml.etree._Element.makeelement" class="py-name" href="#" onclick="return doclink('link-18', 'makeelement', 'link-14');">makeelement</a></tt> </tt>
149 </div><a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"> </tt>
150 <a name="ElementTreeContentHandler._get_etree"></a><div id="ElementTreeContentHandler._get_etree-def"><a name="L43"></a><tt class="py-lineno"> 43</tt> <a class="py-toggle" href="#" id="ElementTreeContentHandler._get_etree-toggle" onclick="return toggle('ElementTreeContentHandler._get_etree');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax.ElementTreeContentHandler-class.html#_get_etree">_get_etree</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
151 </div><div id="ElementTreeContentHandler._get_etree-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeContentHandler._get_etree-expanded"><a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line">        <tt class="py-docstring">"Contains the generated ElementTree after parsing is finished."</tt> </tt>
152 <a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt id="link-19" class="py-name"><a title="lxml.etree.ElementTree
153 xml.etree.ElementTree
154 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-19', 'ElementTree', 'link-6');">ElementTree</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_root</tt><tt class="py-op">)</tt> </tt>
155 </div><a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line"> </tt>
156 <a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line">    <tt id="link-20" class="py-name"><a title="lxml.etree
157 lxml.sax.ElementTreeContentHandler.etree
158 lxml.tests.test_elementtree.CElementTreeTestCase.etree
159 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
160 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-20', 'etree', 'link-3');">etree</a></tt> <tt class="py-op">=</tt> <tt class="py-name">property</tt><tt class="py-op">(</tt><tt id="link-21" class="py-name" targets="Method lxml.sax.ElementTreeContentHandler._get_etree()=lxml.sax.ElementTreeContentHandler-class.html#_get_etree"><a title="lxml.sax.ElementTreeContentHandler._get_etree" class="py-name" href="#" onclick="return doclink('link-21', '_get_etree', 'link-21');">_get_etree</a></tt><tt class="py-op">,</tt> <tt class="py-name">doc</tt><tt class="py-op">=</tt><tt id="link-22" class="py-name"><a title="lxml.sax.ElementTreeContentHandler._get_etree" class="py-name" href="#" onclick="return doclink('link-22', '_get_etree', 'link-21');">_get_etree</a></tt><tt class="py-op">.</tt><tt id="link-23" class="py-name" targets="Variable lxml.html.ElementSoup.__doc__=lxml.html.ElementSoup-module.html#__doc__,Variable lxml.html.soupparser.__doc__=lxml.html.soupparser-module.html#__doc__"><a title="lxml.html.ElementSoup.__doc__
161 lxml.html.soupparser.__doc__" class="py-name" href="#" onclick="return doclink('link-23', '__doc__', 'link-23');">__doc__</a></tt><tt class="py-op">)</tt> </tt>
162 <a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line">     </tt>
163 <a name="ElementTreeContentHandler.setDocumentLocator"></a><div id="ElementTreeContentHandler.setDocumentLocator-def"><a name="L49"></a><tt class="py-lineno"> 49</tt> <a class="py-toggle" href="#" id="ElementTreeContentHandler.setDocumentLocator-toggle" onclick="return toggle('ElementTreeContentHandler.setDocumentLocator');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax.ElementTreeContentHandler-class.html#setDocumentLocator">setDocumentLocator</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">locator</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
164 </div><div id="ElementTreeContentHandler.setDocumentLocator-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeContentHandler.setDocumentLocator-expanded"><a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line">        <tt class="py-keyword">pass</tt> </tt>
165 </div><a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line"> </tt>
166 <a name="ElementTreeContentHandler.startDocument"></a><div id="ElementTreeContentHandler.startDocument-def"><a name="L52"></a><tt class="py-lineno"> 52</tt> <a class="py-toggle" href="#" id="ElementTreeContentHandler.startDocument-toggle" onclick="return toggle('ElementTreeContentHandler.startDocument');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax.ElementTreeContentHandler-class.html#startDocument">startDocument</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
167 </div><div id="ElementTreeContentHandler.startDocument-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeContentHandler.startDocument-expanded"><a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line">        <tt class="py-keyword">pass</tt> </tt>
168 </div><a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line"> </tt>
169 <a name="ElementTreeContentHandler.endDocument"></a><div id="ElementTreeContentHandler.endDocument-def"><a name="L55"></a><tt class="py-lineno"> 55</tt> <a class="py-toggle" href="#" id="ElementTreeContentHandler.endDocument-toggle" onclick="return toggle('ElementTreeContentHandler.endDocument');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax.ElementTreeContentHandler-class.html#endDocument">endDocument</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
170 </div><div id="ElementTreeContentHandler.endDocument-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeContentHandler.endDocument-expanded"><a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line">        <tt class="py-keyword">pass</tt> </tt>
171 </div><a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line"> </tt>
172 <a name="ElementTreeContentHandler.startPrefixMapping"></a><div id="ElementTreeContentHandler.startPrefixMapping-def"><a name="L58"></a><tt class="py-lineno"> 58</tt> <a class="py-toggle" href="#" id="ElementTreeContentHandler.startPrefixMapping-toggle" onclick="return toggle('ElementTreeContentHandler.startPrefixMapping');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax.ElementTreeContentHandler-class.html#startPrefixMapping">startPrefixMapping</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">prefix</tt><tt class="py-op">,</tt> <tt class="py-param">uri</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
173 </div><div id="ElementTreeContentHandler.startPrefixMapping-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeContentHandler.startPrefixMapping-expanded"><a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_new_mappings</tt><tt class="py-op">[</tt><tt id="link-24" class="py-name" targets="Variable lxml.etree._Element.prefix=lxml.etree._Element-class.html#prefix,Variable lxml.etree._ReadOnlyElementProxy.prefix=lxml.etree._ReadOnlyElementProxy-class.html#prefix,Variable lxml.etree._XPathFunctionNamespaceRegistry.prefix=lxml.etree._XPathFunctionNamespaceRegistry-class.html#prefix"><a title="lxml.etree._Element.prefix
174 lxml.etree._ReadOnlyElementProxy.prefix
175 lxml.etree._XPathFunctionNamespaceRegistry.prefix" class="py-name" href="#" onclick="return doclink('link-24', 'prefix', 'link-24');">prefix</a></tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-25" class="py-name" targets="Variable lxml.tests.test_xpathevaluator.uri=lxml.tests.test_xpathevaluator-module.html#uri"><a title="lxml.tests.test_xpathevaluator.uri" class="py-name" href="#" onclick="return doclink('link-25', 'uri', 'link-25');">uri</a></tt> </tt>
176 <a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
177 <a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_ns_mapping</tt><tt class="py-op">[</tt><tt id="link-26" class="py-name"><a title="lxml.etree._Element.prefix
178 lxml.etree._ReadOnlyElementProxy.prefix
179 lxml.etree._XPathFunctionNamespaceRegistry.prefix" class="py-name" href="#" onclick="return doclink('link-26', 'prefix', 'link-24');">prefix</a></tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt id="link-27" class="py-name" targets="Method lxml.etree._AppendOnlyElementProxy.append()=lxml.etree._AppendOnlyElementProxy-class.html#append,Method lxml.etree._Element.append()=lxml.etree._Element-class.html#append,Method lxml.etree._OpaqueDocumentWrapper.append()=lxml.etree._OpaqueDocumentWrapper-class.html#append,Method lxml.etree.__ContentOnlyElement.append()=lxml.etree.__ContentOnlyElement-class.html#append"><a title="lxml.etree._AppendOnlyElementProxy.append
180 lxml.etree._Element.append
181 lxml.etree._OpaqueDocumentWrapper.append
182 lxml.etree.__ContentOnlyElement.append" class="py-name" href="#" onclick="return doclink('link-27', 'append', 'link-27');">append</a></tt><tt class="py-op">(</tt><tt id="link-28" class="py-name"><a title="lxml.tests.test_xpathevaluator.uri" class="py-name" href="#" onclick="return doclink('link-28', 'uri', 'link-25');">uri</a></tt><tt class="py-op">)</tt> </tt>
183 <a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">KeyError</tt><tt class="py-op">:</tt> </tt>
184 <a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_ns_mapping</tt><tt class="py-op">[</tt><tt id="link-29" class="py-name"><a title="lxml.etree._Element.prefix
185 lxml.etree._ReadOnlyElementProxy.prefix
186 lxml.etree._XPathFunctionNamespaceRegistry.prefix" class="py-name" href="#" onclick="return doclink('link-29', 'prefix', 'link-24');">prefix</a></tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt id="link-30" class="py-name"><a title="lxml.tests.test_xpathevaluator.uri" class="py-name" href="#" onclick="return doclink('link-30', 'uri', 'link-25');">uri</a></tt><tt class="py-op">]</tt> </tt>
187 <a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-31" class="py-name"><a title="lxml.etree._Element.prefix
188 lxml.etree._ReadOnlyElementProxy.prefix
189 lxml.etree._XPathFunctionNamespaceRegistry.prefix" class="py-name" href="#" onclick="return doclink('link-31', 'prefix', 'link-24');">prefix</a></tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
190 <a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_default_ns</tt> <tt class="py-op">=</tt> <tt id="link-32" class="py-name"><a title="lxml.tests.test_xpathevaluator.uri" class="py-name" href="#" onclick="return doclink('link-32', 'uri', 'link-25');">uri</a></tt> </tt>
191 </div><a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line"> </tt>
192 <a name="ElementTreeContentHandler.endPrefixMapping"></a><div id="ElementTreeContentHandler.endPrefixMapping-def"><a name="L67"></a><tt class="py-lineno"> 67</tt> <a class="py-toggle" href="#" id="ElementTreeContentHandler.endPrefixMapping-toggle" onclick="return toggle('ElementTreeContentHandler.endPrefixMapping');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax.ElementTreeContentHandler-class.html#endPrefixMapping">endPrefixMapping</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">prefix</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
193 </div><div id="ElementTreeContentHandler.endPrefixMapping-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeContentHandler.endPrefixMapping-expanded"><a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line">        <tt class="py-name">ns_uri_list</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_ns_mapping</tt><tt class="py-op">[</tt><tt id="link-33" class="py-name"><a title="lxml.etree._Element.prefix
194 lxml.etree._ReadOnlyElementProxy.prefix
195 lxml.etree._XPathFunctionNamespaceRegistry.prefix" class="py-name" href="#" onclick="return doclink('link-33', 'prefix', 'link-24');">prefix</a></tt><tt class="py-op">]</tt> </tt>
196 <a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line">        <tt class="py-name">ns_uri_list</tt><tt class="py-op">.</tt><tt id="link-34" class="py-name" targets="Method lxml.etree._Attrib.pop()=lxml.etree._Attrib-class.html#pop"><a title="lxml.etree._Attrib.pop" class="py-name" href="#" onclick="return doclink('link-34', 'pop', 'link-34');">pop</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
197 <a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-35" class="py-name"><a title="lxml.etree._Element.prefix
198 lxml.etree._ReadOnlyElementProxy.prefix
199 lxml.etree._XPathFunctionNamespaceRegistry.prefix" class="py-name" href="#" onclick="return doclink('link-35', 'prefix', 'link-24');">prefix</a></tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
200 <a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_default_ns</tt> <tt class="py-op">=</tt> <tt class="py-name">ns_uri_list</tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
201 </div><a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line"> </tt>
202 <a name="ElementTreeContentHandler._buildTag"></a><div id="ElementTreeContentHandler._buildTag-def"><a name="L73"></a><tt class="py-lineno"> 73</tt> <a class="py-toggle" href="#" id="ElementTreeContentHandler._buildTag-toggle" onclick="return toggle('ElementTreeContentHandler._buildTag');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax.ElementTreeContentHandler-class.html#_buildTag">_buildTag</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">ns_name_tuple</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
203 </div><div id="ElementTreeContentHandler._buildTag-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeContentHandler._buildTag-expanded"><a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line">        <tt class="py-name">ns_uri</tt><tt class="py-op">,</tt> <tt class="py-name">local_name</tt> <tt class="py-op">=</tt> <tt class="py-name">ns_name_tuple</tt> </tt>
204 <a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">ns_uri</tt><tt class="py-op">:</tt> </tt>
205 <a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line">            <tt class="py-name">el_tag</tt> <tt class="py-op">=</tt> <tt class="py-string">"{%s}%s"</tt> <tt class="py-op">%</tt> <tt class="py-name">ns_name_tuple</tt> </tt>
206 <a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_default_ns</tt><tt class="py-op">:</tt> </tt>
207 <a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line">            <tt class="py-name">el_tag</tt> <tt class="py-op">=</tt> <tt class="py-string">"{%s}%s"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_default_ns</tt><tt class="py-op">,</tt> <tt class="py-name">local_name</tt><tt class="py-op">)</tt> </tt>
208 <a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
209 <a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line">            <tt class="py-name">el_tag</tt> <tt class="py-op">=</tt> <tt class="py-name">local_name</tt> </tt>
210 <a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">el_tag</tt> </tt>
211 </div><a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line"> </tt>
212 <a name="ElementTreeContentHandler.startElementNS"></a><div id="ElementTreeContentHandler.startElementNS-def"><a name="L83"></a><tt class="py-lineno"> 83</tt> <a class="py-toggle" href="#" id="ElementTreeContentHandler.startElementNS-toggle" onclick="return toggle('ElementTreeContentHandler.startElementNS');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax.ElementTreeContentHandler-class.html#startElementNS">startElementNS</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">ns_name</tt><tt class="py-op">,</tt> <tt class="py-param">qname</tt><tt class="py-op">,</tt> <tt class="py-param">attributes</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
213 </div><div id="ElementTreeContentHandler.startElementNS-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeContentHandler.startElementNS-expanded"><a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line">        <tt class="py-name">el_name</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-36" class="py-name" targets="Method lxml.sax.ElementTreeContentHandler._buildTag()=lxml.sax.ElementTreeContentHandler-class.html#_buildTag"><a title="lxml.sax.ElementTreeContentHandler._buildTag" class="py-name" href="#" onclick="return doclink('link-36', '_buildTag', 'link-36');">_buildTag</a></tt><tt class="py-op">(</tt><tt class="py-name">ns_name</tt><tt class="py-op">)</tt> </tt>
214 <a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">attributes</tt><tt class="py-op">:</tt> </tt>
215 <a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line">            <tt class="py-name">attrs</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
216 <a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line">            <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
217 <a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line">                <tt class="py-name">iter_attributes</tt> <tt class="py-op">=</tt> <tt class="py-name">attributes</tt><tt class="py-op">.</tt><tt id="link-37" class="py-name" targets="Method lxml.etree._Attrib.iteritems()=lxml.etree._Attrib-class.html#iteritems,Method lxml.etree._IDDict.iteritems()=lxml.etree._IDDict-class.html#iteritems,Method lxml.etree._NamespaceRegistry.iteritems()=lxml.etree._NamespaceRegistry-class.html#iteritems"><a title="lxml.etree._Attrib.iteritems
218 lxml.etree._IDDict.iteritems
219 lxml.etree._NamespaceRegistry.iteritems" class="py-name" href="#" onclick="return doclink('link-37', 'iteritems', 'link-37');">iteritems</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
220 <a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">            <tt class="py-keyword">except</tt> <tt class="py-name">AttributeError</tt><tt class="py-op">:</tt> </tt>
221 <a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line">                <tt class="py-name">iter_attributes</tt> <tt class="py-op">=</tt> <tt class="py-name">attributes</tt><tt class="py-op">.</tt><tt id="link-38" class="py-name" targets="Method lxml.etree._Attrib.items()=lxml.etree._Attrib-class.html#items,Method lxml.etree._Element.items()=lxml.etree._Element-class.html#items,Method lxml.etree._IDDict.items()=lxml.etree._IDDict-class.html#items,Method lxml.etree._NamespaceRegistry.items()=lxml.etree._NamespaceRegistry-class.html#items,Method lxml.etree._ReadOnlyElementProxy.items()=lxml.etree._ReadOnlyElementProxy-class.html#items,Method lxml.etree.__ContentOnlyElement.items()=lxml.etree.__ContentOnlyElement-class.html#items"><a title="lxml.etree._Attrib.items
222 lxml.etree._Element.items
223 lxml.etree._IDDict.items
224 lxml.etree._NamespaceRegistry.items
225 lxml.etree._ReadOnlyElementProxy.items
226 lxml.etree.__ContentOnlyElement.items" class="py-name" href="#" onclick="return doclink('link-38', 'items', 'link-38');">items</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
227 <a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line"> </tt>
228 <a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">name_tuple</tt><tt class="py-op">,</tt> <tt id="link-39" class="py-name" targets="Variable lxml.html.CheckboxGroup.value=lxml.html.CheckboxGroup-class.html#value,Variable lxml.html.InputElement.value=lxml.html.InputElement-class.html#value,Variable lxml.html.RadioGroup.value=lxml.html.RadioGroup-class.html#value,Variable lxml.html.SelectElement.value=lxml.html.SelectElement-class.html#value,Variable lxml.html.TextareaElement.value=lxml.html.TextareaElement-class.html#value"><a title="lxml.html.CheckboxGroup.value
229 lxml.html.InputElement.value
230 lxml.html.RadioGroup.value
231 lxml.html.SelectElement.value
232 lxml.html.TextareaElement.value" class="py-name" href="#" onclick="return doclink('link-39', 'value', 'link-39');">value</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">iter_attributes</tt><tt class="py-op">:</tt> </tt>
233 <a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">name_tuple</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
234 <a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line">                    <tt class="py-name">attr_name</tt> <tt class="py-op">=</tt> <tt class="py-string">"{%s}%s"</tt> <tt class="py-op">%</tt> <tt class="py-name">name_tuple</tt> </tt>
235 <a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">                <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
236 <a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line">                    <tt class="py-name">attr_name</tt> <tt class="py-op">=</tt> <tt class="py-name">name_tuple</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
237 <a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">                <tt class="py-name">attrs</tt><tt class="py-op">[</tt><tt class="py-name">attr_name</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-40" class="py-name"><a title="lxml.html.CheckboxGroup.value
238 lxml.html.InputElement.value
239 lxml.html.RadioGroup.value
240 lxml.html.SelectElement.value
241 lxml.html.TextareaElement.value" class="py-name" href="#" onclick="return doclink('link-40', 'value', 'link-39');">value</a></tt> </tt>
242 <a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
243 <a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">            <tt class="py-name">attrs</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
244 <a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line"> </tt>
245 <a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line">        <tt class="py-name">element_stack</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_element_stack</tt> </tt>
246 <a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_root</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
247 <a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line">            <tt class="py-name">element</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_root</tt> <tt class="py-op">=</tt> \ </tt>
248 <a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line">                      <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_makeelement</tt><tt class="py-op">(</tt><tt class="py-name">el_name</tt><tt class="py-op">,</tt> <tt class="py-name">attrs</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_new_mappings</tt><tt class="py-op">)</tt> </tt>
249 <a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_root_siblings</tt> <tt class="py-keyword">and</tt> <tt id="link-41" class="py-name" targets="Method lxml.objectify.ObjectPath.hasattr()=lxml.objectify.ObjectPath-class.html#hasattr"><a title="lxml.objectify.ObjectPath.hasattr" class="py-name" href="#" onclick="return doclink('link-41', 'hasattr', 'link-41');">hasattr</a></tt><tt class="py-op">(</tt><tt class="py-name">element</tt><tt class="py-op">,</tt> <tt class="py-string">'addprevious'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
250 <a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line">                <tt class="py-keyword">for</tt> <tt class="py-name">sibling</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_root_siblings</tt><tt class="py-op">:</tt> </tt>
251 <a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line">                    <tt class="py-name">element</tt><tt class="py-op">.</tt><tt id="link-42" class="py-name" targets="Method lxml.etree._Element.addprevious()=lxml.etree._Element-class.html#addprevious"><a title="lxml.etree._Element.addprevious" class="py-name" href="#" onclick="return doclink('link-42', 'addprevious', 'link-42');">addprevious</a></tt><tt class="py-op">(</tt><tt class="py-name">sibling</tt><tt class="py-op">)</tt> </tt>
252 <a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line">            <tt class="py-keyword">del</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_root_siblings</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
253 <a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
254 <a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line">            <tt class="py-name">element</tt> <tt class="py-op">=</tt> <tt id="link-43" class="py-name"><a title="lxml.etree.SubElement" class="py-name" href="#" onclick="return doclink('link-43', 'SubElement', 'link-7');">SubElement</a></tt><tt class="py-op">(</tt><tt class="py-name">element_stack</tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-name">el_name</tt><tt class="py-op">,</tt> </tt>
255 <a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line">                                 <tt class="py-name">attrs</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_new_mappings</tt><tt class="py-op">)</tt> </tt>
256 <a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line">        <tt class="py-name">element_stack</tt><tt class="py-op">.</tt><tt id="link-44" class="py-name"><a title="lxml.etree._AppendOnlyElementProxy.append
257 lxml.etree._Element.append
258 lxml.etree._OpaqueDocumentWrapper.append
259 lxml.etree.__ContentOnlyElement.append" class="py-name" href="#" onclick="return doclink('link-44', 'append', 'link-27');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">element</tt><tt class="py-op">)</tt> </tt>
260 <a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line"> </tt>
261 <a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_new_mappings</tt><tt class="py-op">.</tt><tt id="link-45" class="py-name" targets="Method lxml.etree._Attrib.clear()=lxml.etree._Attrib-class.html#clear,Method lxml.etree._Element.clear()=lxml.etree._Element-class.html#clear,Method lxml.etree._ErrorLog.clear()=lxml.etree._ErrorLog-class.html#clear,Method lxml.etree._NamespaceRegistry.clear()=lxml.etree._NamespaceRegistry-class.html#clear"><a title="lxml.etree._Attrib.clear
262 lxml.etree._Element.clear
263 lxml.etree._ErrorLog.clear
264 lxml.etree._NamespaceRegistry.clear" class="py-name" href="#" onclick="return doclink('link-45', 'clear', 'link-45');">clear</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
265 </div><a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line"> </tt>
266 <a name="ElementTreeContentHandler.processingInstruction"></a><div id="ElementTreeContentHandler.processingInstruction-def"><a name="L116"></a><tt class="py-lineno">116</tt> <a class="py-toggle" href="#" id="ElementTreeContentHandler.processingInstruction-toggle" onclick="return toggle('ElementTreeContentHandler.processingInstruction');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax.ElementTreeContentHandler-class.html#processingInstruction">processingInstruction</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">target</tt><tt class="py-op">,</tt> <tt class="py-param">data</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
267 </div><div id="ElementTreeContentHandler.processingInstruction-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeContentHandler.processingInstruction-expanded"><a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line">        <tt id="link-46" class="py-name" targets="Method lxml.etree.TreeBuilder.pi()=lxml.etree.TreeBuilder-class.html#pi"><a title="lxml.etree.TreeBuilder.pi" class="py-name" href="#" onclick="return doclink('link-46', 'pi', 'link-46');">pi</a></tt> <tt class="py-op">=</tt> <tt class="py-name">ProcessingInstruction</tt><tt class="py-op">(</tt><tt id="link-47" class="py-name" targets="Variable lxml.etree._BaseParser.target=lxml.etree._BaseParser-class.html#target,Variable lxml.etree._ModifyContentOnlyPIProxy.target=lxml.etree._ModifyContentOnlyPIProxy-class.html#target,Variable lxml.etree._ProcessingInstruction.target=lxml.etree._ProcessingInstruction-class.html#target,Variable lxml.etree._ReadOnlyPIProxy.target=lxml.etree._ReadOnlyPIProxy-class.html#target"><a title="lxml.etree._BaseParser.target
268 lxml.etree._ModifyContentOnlyPIProxy.target
269 lxml.etree._ProcessingInstruction.target
270 lxml.etree._ReadOnlyPIProxy.target" class="py-name" href="#" onclick="return doclink('link-47', 'target', 'link-47');">target</a></tt><tt class="py-op">,</tt> <tt id="link-48" class="py-name" targets="Method lxml.etree.TreeBuilder.data()=lxml.etree.TreeBuilder-class.html#data"><a title="lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-48', 'data', 'link-48');">data</a></tt><tt class="py-op">)</tt> </tt>
271 <a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_root</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
272 <a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_root_siblings</tt><tt class="py-op">.</tt><tt id="link-49" class="py-name"><a title="lxml.etree._AppendOnlyElementProxy.append
273 lxml.etree._Element.append
274 lxml.etree._OpaqueDocumentWrapper.append
275 lxml.etree.__ContentOnlyElement.append" class="py-name" href="#" onclick="return doclink('link-49', 'append', 'link-27');">append</a></tt><tt class="py-op">(</tt><tt id="link-50" class="py-name"><a title="lxml.etree.TreeBuilder.pi" class="py-name" href="#" onclick="return doclink('link-50', 'pi', 'link-46');">pi</a></tt><tt class="py-op">)</tt> </tt>
276 <a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
277 <a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_element_stack</tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt id="link-51" class="py-name"><a title="lxml.etree._AppendOnlyElementProxy.append
278 lxml.etree._Element.append
279 lxml.etree._OpaqueDocumentWrapper.append
280 lxml.etree.__ContentOnlyElement.append" class="py-name" href="#" onclick="return doclink('link-51', 'append', 'link-27');">append</a></tt><tt class="py-op">(</tt><tt id="link-52" class="py-name"><a title="lxml.etree.TreeBuilder.pi" class="py-name" href="#" onclick="return doclink('link-52', 'pi', 'link-46');">pi</a></tt><tt class="py-op">)</tt> </tt>
281 </div><a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line"> </tt>
282 <a name="ElementTreeContentHandler.endElementNS"></a><div id="ElementTreeContentHandler.endElementNS-def"><a name="L123"></a><tt class="py-lineno">123</tt> <a class="py-toggle" href="#" id="ElementTreeContentHandler.endElementNS-toggle" onclick="return toggle('ElementTreeContentHandler.endElementNS');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax.ElementTreeContentHandler-class.html#endElementNS">endElementNS</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">ns_name</tt><tt class="py-op">,</tt> <tt class="py-param">qname</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
283 </div><div id="ElementTreeContentHandler.endElementNS-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeContentHandler.endElementNS-expanded"><a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">        <tt class="py-name">element</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_element_stack</tt><tt class="py-op">.</tt><tt id="link-53" class="py-name"><a title="lxml.etree._Attrib.pop" class="py-name" href="#" onclick="return doclink('link-53', 'pop', 'link-34');">pop</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
284 <a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line">        <tt class="py-name">el_tag</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-54" class="py-name"><a title="lxml.sax.ElementTreeContentHandler._buildTag" class="py-name" href="#" onclick="return doclink('link-54', '_buildTag', 'link-36');">_buildTag</a></tt><tt class="py-op">(</tt><tt class="py-name">ns_name</tt><tt class="py-op">)</tt> </tt>
285 <a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">el_tag</tt> <tt class="py-op">!=</tt> <tt class="py-name">element</tt><tt class="py-op">.</tt><tt id="link-55" class="py-name"><a title="lxml.etree._Comment.tag
286 lxml.etree._Element.tag
287 lxml.etree._Entity.tag
288 lxml.etree._ProcessingInstruction.tag
289 lxml.etree._ReadOnlyProxy.tag
290 lxml.tests.test_xpathevaluator.tag
291 xml.etree.ElementTree.Element.tag" class="py-name" href="#" onclick="return doclink('link-55', 'tag', 'link-11');">tag</a></tt><tt class="py-op">:</tt> </tt>
292 <a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-56" class="py-name" targets="Class lxml.sax.SaxError=lxml.sax.SaxError-class.html"><a title="lxml.sax.SaxError" class="py-name" href="#" onclick="return doclink('link-56', 'SaxError', 'link-56');">SaxError</a></tt><tt class="py-op">(</tt><tt class="py-string">"Unexpected element closed: "</tt> <tt class="py-op">+</tt> <tt class="py-name">el_tag</tt><tt class="py-op">)</tt> </tt>
293 </div><a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line"> </tt>
294 <a name="ElementTreeContentHandler.startElement"></a><div id="ElementTreeContentHandler.startElement-def"><a name="L129"></a><tt class="py-lineno">129</tt> <a class="py-toggle" href="#" id="ElementTreeContentHandler.startElement-toggle" onclick="return toggle('ElementTreeContentHandler.startElement');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax.ElementTreeContentHandler-class.html#startElement">startElement</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">name</tt><tt class="py-op">,</tt> <tt class="py-param">attributes</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
295 </div><div id="ElementTreeContentHandler.startElement-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeContentHandler.startElement-expanded"><a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-57" class="py-name" targets="Method lxml.sax.ElementTreeContentHandler.startElementNS()=lxml.sax.ElementTreeContentHandler-class.html#startElementNS"><a title="lxml.sax.ElementTreeContentHandler.startElementNS" class="py-name" href="#" onclick="return doclink('link-57', 'startElementNS', 'link-57');">startElementNS</a></tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt id="link-58" class="py-name" targets="Variable lxml.etree._Entity.name=lxml.etree._Entity-class.html#name,Variable lxml.etree._ModifyContentOnlyEntityProxy.name=lxml.etree._ModifyContentOnlyEntityProxy-class.html#name,Variable lxml.etree._ReadOnlyEntityProxy.name=lxml.etree._ReadOnlyEntityProxy-class.html#name,Variable lxml.html.InputMixin.name=lxml.html.InputMixin-class.html#name,Variable lxml.objectify.PyType.name=lxml.objectify.PyType-class.html#name"><a title="lxml.etree._Entity.name
296 lxml.etree._ModifyContentOnlyEntityProxy.name
297 lxml.etree._ReadOnlyEntityProxy.name
298 lxml.html.InputMixin.name
299 lxml.objectify.PyType.name" class="py-name" href="#" onclick="return doclink('link-58', 'name', 'link-58');">name</a></tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt id="link-59" class="py-name"><a title="lxml.etree._Entity.name
300 lxml.etree._ModifyContentOnlyEntityProxy.name
301 lxml.etree._ReadOnlyEntityProxy.name
302 lxml.html.InputMixin.name
303 lxml.objectify.PyType.name" class="py-name" href="#" onclick="return doclink('link-59', 'name', 'link-58');">name</a></tt><tt class="py-op">,</tt> <tt class="py-name">attributes</tt><tt class="py-op">)</tt> </tt>
304 </div><a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line"> </tt>
305 <a name="ElementTreeContentHandler.endElement"></a><div id="ElementTreeContentHandler.endElement-def"><a name="L132"></a><tt class="py-lineno">132</tt> <a class="py-toggle" href="#" id="ElementTreeContentHandler.endElement-toggle" onclick="return toggle('ElementTreeContentHandler.endElement');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax.ElementTreeContentHandler-class.html#endElement">endElement</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">name</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
306 </div><div id="ElementTreeContentHandler.endElement-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeContentHandler.endElement-expanded"><a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-60" class="py-name" targets="Method lxml.sax.ElementTreeContentHandler.endElementNS()=lxml.sax.ElementTreeContentHandler-class.html#endElementNS"><a title="lxml.sax.ElementTreeContentHandler.endElementNS" class="py-name" href="#" onclick="return doclink('link-60', 'endElementNS', 'link-60');">endElementNS</a></tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt id="link-61" class="py-name"><a title="lxml.etree._Entity.name
307 lxml.etree._ModifyContentOnlyEntityProxy.name
308 lxml.etree._ReadOnlyEntityProxy.name
309 lxml.html.InputMixin.name
310 lxml.objectify.PyType.name" class="py-name" href="#" onclick="return doclink('link-61', 'name', 'link-58');">name</a></tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt id="link-62" class="py-name"><a title="lxml.etree._Entity.name
311 lxml.etree._ModifyContentOnlyEntityProxy.name
312 lxml.etree._ReadOnlyEntityProxy.name
313 lxml.html.InputMixin.name
314 lxml.objectify.PyType.name" class="py-name" href="#" onclick="return doclink('link-62', 'name', 'link-58');">name</a></tt><tt class="py-op">)</tt> </tt>
315 </div><a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line"> </tt>
316 <a name="ElementTreeContentHandler.characters"></a><div id="ElementTreeContentHandler.characters-def"><a name="L135"></a><tt class="py-lineno">135</tt> <a class="py-toggle" href="#" id="ElementTreeContentHandler.characters-toggle" onclick="return toggle('ElementTreeContentHandler.characters');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax.ElementTreeContentHandler-class.html#characters">characters</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">data</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
317 </div><div id="ElementTreeContentHandler.characters-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeContentHandler.characters-expanded"><a name="L136"></a><tt class="py-lineno">136</tt>  <tt class="py-line">        <tt class="py-name">last_element</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_element_stack</tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
318 <a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
319 <a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line">            <tt class="py-comment"># if there already is a child element, we must append to its tail</tt> </tt>
320 <a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line">            <tt class="py-name">last_element</tt> <tt class="py-op">=</tt> <tt class="py-name">last_element</tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
321 <a name="L140"></a><tt class="py-lineno">140</tt>  <tt class="py-line">            <tt class="py-name">last_element</tt><tt class="py-op">.</tt><tt id="link-63" class="py-name" targets="Variable lxml.etree._Element.tail=lxml.etree._Element-class.html#tail,Variable lxml.etree._ReadOnlyProxy.tail=lxml.etree._ReadOnlyProxy-class.html#tail,Variable xml.etree.ElementTree.Element.tail=xml.etree.ElementTree.Element-class.html#tail"><a title="lxml.etree._Element.tail
322 lxml.etree._ReadOnlyProxy.tail
323 xml.etree.ElementTree.Element.tail" class="py-name" href="#" onclick="return doclink('link-63', 'tail', 'link-63');">tail</a></tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-name">last_element</tt><tt class="py-op">.</tt><tt id="link-64" class="py-name"><a title="lxml.etree._Element.tail
324 lxml.etree._ReadOnlyProxy.tail
325 xml.etree.ElementTree.Element.tail" class="py-name" href="#" onclick="return doclink('link-64', 'tail', 'link-63');">tail</a></tt> <tt class="py-keyword">or</tt> <tt class="py-string">''</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt id="link-65" class="py-name"><a title="lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-65', 'data', 'link-48');">data</a></tt> </tt>
326 <a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">IndexError</tt><tt class="py-op">:</tt> </tt>
327 <a name="L142"></a><tt class="py-lineno">142</tt>  <tt class="py-line">            <tt class="py-comment"># otherwise: append to the text</tt> </tt>
328 <a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line">            <tt class="py-name">last_element</tt><tt class="py-op">.</tt><tt id="link-66" class="py-name" targets="Variable lxml.etree.QName.text=lxml.etree.QName-class.html#text,Variable lxml.etree._AppendOnlyElementProxy.text=lxml.etree._AppendOnlyElementProxy-class.html#text,Variable lxml.etree._Element.text=lxml.etree._Element-class.html#text,Variable lxml.etree._Entity.text=lxml.etree._Entity-class.html#text,Variable lxml.etree._ModifyContentOnlyProxy.text=lxml.etree._ModifyContentOnlyProxy-class.html#text,Variable lxml.etree._ReadOnlyEntityProxy.text=lxml.etree._ReadOnlyEntityProxy-class.html#text,Variable lxml.etree._ReadOnlyProxy.text=lxml.etree._ReadOnlyProxy-class.html#text,Variable lxml.etree.__ContentOnlyElement.text=lxml.etree.__ContentOnlyElement-class.html#text,Variable lxml.objectify.ObjectifiedElement.text=lxml.objectify.ObjectifiedElement-class.html#text,Variable xml.etree.ElementTree.Element.text=xml.etree.ElementTree.Element-class.html#text"><a title="lxml.etree.QName.text
329 lxml.etree._AppendOnlyElementProxy.text
330 lxml.etree._Element.text
331 lxml.etree._Entity.text
332 lxml.etree._ModifyContentOnlyProxy.text
333 lxml.etree._ReadOnlyEntityProxy.text
334 lxml.etree._ReadOnlyProxy.text
335 lxml.etree.__ContentOnlyElement.text
336 lxml.objectify.ObjectifiedElement.text
337 xml.etree.ElementTree.Element.text" class="py-name" href="#" onclick="return doclink('link-66', 'text', 'link-66');">text</a></tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-name">last_element</tt><tt class="py-op">.</tt><tt id="link-67" class="py-name"><a title="lxml.etree.QName.text
338 lxml.etree._AppendOnlyElementProxy.text
339 lxml.etree._Element.text
340 lxml.etree._Entity.text
341 lxml.etree._ModifyContentOnlyProxy.text
342 lxml.etree._ReadOnlyEntityProxy.text
343 lxml.etree._ReadOnlyProxy.text
344 lxml.etree.__ContentOnlyElement.text
345 lxml.objectify.ObjectifiedElement.text
346 xml.etree.ElementTree.Element.text" class="py-name" href="#" onclick="return doclink('link-67', 'text', 'link-66');">text</a></tt> <tt class="py-keyword">or</tt> <tt class="py-string">''</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt id="link-68" class="py-name"><a title="lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-68', 'data', 'link-48');">data</a></tt> </tt>
347 </div><a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line"> </tt>
348 <a name="L145"></a><tt class="py-lineno">145</tt>  <tt class="py-line">    <tt class="py-name">ignorableWhitespace</tt> <tt class="py-op">=</tt> <tt id="link-69" class="py-name" targets="Method lxml.sax.ElementTreeContentHandler.characters()=lxml.sax.ElementTreeContentHandler-class.html#characters"><a title="lxml.sax.ElementTreeContentHandler.characters" class="py-name" href="#" onclick="return doclink('link-69', 'characters', 'link-69');">characters</a></tt> </tt>
349 </div><a name="L146"></a><tt class="py-lineno">146</tt>  <tt class="py-line">         </tt>
350 <a name="L147"></a><tt class="py-lineno">147</tt>  <tt class="py-line"> </tt>
351 <a name="ElementTreeProducer"></a><div id="ElementTreeProducer-def"><a name="L148"></a><tt class="py-lineno">148</tt> <a class="py-toggle" href="#" id="ElementTreeProducer-toggle" onclick="return toggle('ElementTreeProducer');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lxml.sax.ElementTreeProducer-class.html">ElementTreeProducer</a><tt class="py-op">(</tt><tt class="py-base-class">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
352 </div><div id="ElementTreeProducer-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="ElementTreeProducer-expanded"><a name="L149"></a><tt class="py-lineno">149</tt>  <tt class="py-line">    <tt class="py-docstring">"""Produces SAX events for an element and children.</tt> </tt>
353 <a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
354 <a name="ElementTreeProducer.__init__"></a><div id="ElementTreeProducer.__init__-def"><a name="L151"></a><tt class="py-lineno">151</tt> <a class="py-toggle" href="#" id="ElementTreeProducer.__init__-toggle" onclick="return toggle('ElementTreeProducer.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax.ElementTreeProducer-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">element_or_tree</tt><tt class="py-op">,</tt> <tt class="py-param">content_handler</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
355 </div><div id="ElementTreeProducer.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeProducer.__init__-expanded"><a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
356 <a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line">            <tt class="py-name">element</tt> <tt class="py-op">=</tt> <tt class="py-name">element_or_tree</tt><tt class="py-op">.</tt><tt id="link-70" class="py-name" targets="Method lxml.etree._ElementTree.getroot()=lxml.etree._ElementTree-class.html#getroot"><a title="lxml.etree._ElementTree.getroot" class="py-name" href="#" onclick="return doclink('link-70', 'getroot', 'link-70');">getroot</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
357 <a name="L154"></a><tt class="py-lineno">154</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">AttributeError</tt><tt class="py-op">:</tt> </tt>
358 <a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line">            <tt class="py-name">element</tt> <tt class="py-op">=</tt> <tt class="py-name">element_or_tree</tt> </tt>
359 <a name="L156"></a><tt class="py-lineno">156</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_element</tt> <tt class="py-op">=</tt> <tt class="py-name">element</tt> </tt>
360 <a name="L157"></a><tt class="py-lineno">157</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_content_handler</tt> <tt class="py-op">=</tt> <tt class="py-name">content_handler</tt> </tt>
361 <a name="L158"></a><tt class="py-lineno">158</tt>  <tt class="py-line">        <tt class="py-keyword">from</tt> <tt id="link-71" class="py-name"><a title="lxml.tests.test_threading.ThreadPipelineTestCase.xml" class="py-name" href="#" onclick="return doclink('link-71', 'xml', 'link-0');">xml</a></tt><tt class="py-op">.</tt><tt id="link-72" class="py-name"><a title="lxml.sax" class="py-name" href="#" onclick="return doclink('link-72', 'sax', 'link-1');">sax</a></tt><tt class="py-op">.</tt><tt class="py-name">xmlreader</tt> <tt class="py-keyword">import</tt> <tt class="py-name">AttributesNSImpl</tt> <tt class="py-keyword">as</tt> <tt class="py-name">attr_class</tt> </tt>
362 <a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_attr_class</tt> <tt class="py-op">=</tt> <tt class="py-name">attr_class</tt> </tt>
363 <a name="L160"></a><tt class="py-lineno">160</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_empty_attributes</tt> <tt class="py-op">=</tt> <tt class="py-name">attr_class</tt><tt class="py-op">(</tt><tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">,</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">)</tt> </tt>
364 </div><a name="L161"></a><tt class="py-lineno">161</tt>  <tt class="py-line"> </tt>
365 <a name="ElementTreeProducer.saxify"></a><div id="ElementTreeProducer.saxify-def"><a name="L162"></a><tt class="py-lineno">162</tt> <a class="py-toggle" href="#" id="ElementTreeProducer.saxify-toggle" onclick="return toggle('ElementTreeProducer.saxify');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax.ElementTreeProducer-class.html#saxify">saxify</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
366 </div><div id="ElementTreeProducer.saxify-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeProducer.saxify-expanded"><a name="L163"></a><tt class="py-lineno">163</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_content_handler</tt><tt class="py-op">.</tt><tt id="link-73" class="py-name" targets="Method lxml.sax.ElementTreeContentHandler.startDocument()=lxml.sax.ElementTreeContentHandler-class.html#startDocument"><a title="lxml.sax.ElementTreeContentHandler.startDocument" class="py-name" href="#" onclick="return doclink('link-73', 'startDocument', 'link-73');">startDocument</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
367 <a name="L164"></a><tt class="py-lineno">164</tt>  <tt class="py-line"> </tt>
368 <a name="L165"></a><tt class="py-lineno">165</tt>  <tt class="py-line">        <tt class="py-name">element</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_element</tt> </tt>
369 <a name="L166"></a><tt class="py-lineno">166</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-74" class="py-name"><a title="lxml.objectify.ObjectPath.hasattr" class="py-name" href="#" onclick="return doclink('link-74', 'hasattr', 'link-41');">hasattr</a></tt><tt class="py-op">(</tt><tt class="py-name">element</tt><tt class="py-op">,</tt> <tt class="py-string">'getprevious'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
370 <a name="L167"></a><tt class="py-lineno">167</tt>  <tt class="py-line">            <tt class="py-name">siblings</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
371 <a name="L168"></a><tt class="py-lineno">168</tt>  <tt class="py-line">            <tt class="py-name">sibling</tt> <tt class="py-op">=</tt> <tt class="py-name">element</tt><tt class="py-op">.</tt><tt id="link-75" class="py-name" targets="Method lxml.etree._Element.getprevious()=lxml.etree._Element-class.html#getprevious,Method lxml.etree._ReadOnlyProxy.getprevious()=lxml.etree._ReadOnlyProxy-class.html#getprevious"><a title="lxml.etree._Element.getprevious
372 lxml.etree._ReadOnlyProxy.getprevious" class="py-name" href="#" onclick="return doclink('link-75', 'getprevious', 'link-75');">getprevious</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
373 <a name="L169"></a><tt class="py-lineno">169</tt>  <tt class="py-line">            <tt class="py-keyword">while</tt> <tt class="py-name">getattr</tt><tt class="py-op">(</tt><tt class="py-name">sibling</tt><tt class="py-op">,</tt> <tt class="py-string">'tag'</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">)</tt> <tt class="py-keyword">is</tt> <tt class="py-name">ProcessingInstruction</tt><tt class="py-op">:</tt> </tt>
374 <a name="L170"></a><tt class="py-lineno">170</tt>  <tt class="py-line">                <tt class="py-name">siblings</tt><tt class="py-op">.</tt><tt id="link-76" class="py-name"><a title="lxml.etree._AppendOnlyElementProxy.append
375 lxml.etree._Element.append
376 lxml.etree._OpaqueDocumentWrapper.append
377 lxml.etree.__ContentOnlyElement.append" class="py-name" href="#" onclick="return doclink('link-76', 'append', 'link-27');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">sibling</tt><tt class="py-op">)</tt> </tt>
378 <a name="L171"></a><tt class="py-lineno">171</tt>  <tt class="py-line">                <tt class="py-name">sibling</tt> <tt class="py-op">=</tt> <tt class="py-name">sibling</tt><tt class="py-op">.</tt><tt id="link-77" class="py-name"><a title="lxml.etree._Element.getprevious
379 lxml.etree._ReadOnlyProxy.getprevious" class="py-name" href="#" onclick="return doclink('link-77', 'getprevious', 'link-75');">getprevious</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
380 <a name="L172"></a><tt class="py-lineno">172</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">sibling</tt> <tt class="py-keyword">in</tt> <tt class="py-name">siblings</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
381 <a name="L173"></a><tt class="py-lineno">173</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-78" class="py-name" targets="Method lxml.sax.ElementTreeProducer._recursive_saxify()=lxml.sax.ElementTreeProducer-class.html#_recursive_saxify"><a title="lxml.sax.ElementTreeProducer._recursive_saxify" class="py-name" href="#" onclick="return doclink('link-78', '_recursive_saxify', 'link-78');">_recursive_saxify</a></tt><tt class="py-op">(</tt><tt class="py-name">sibling</tt><tt class="py-op">,</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">)</tt> </tt>
382 <a name="L174"></a><tt class="py-lineno">174</tt>  <tt class="py-line"> </tt>
383 <a name="L175"></a><tt class="py-lineno">175</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-79" class="py-name"><a title="lxml.sax.ElementTreeProducer._recursive_saxify" class="py-name" href="#" onclick="return doclink('link-79', '_recursive_saxify', 'link-78');">_recursive_saxify</a></tt><tt class="py-op">(</tt><tt class="py-name">element</tt><tt class="py-op">,</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">)</tt> </tt>
384 <a name="L176"></a><tt class="py-lineno">176</tt>  <tt class="py-line"> </tt>
385 <a name="L177"></a><tt class="py-lineno">177</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-80" class="py-name"><a title="lxml.objectify.ObjectPath.hasattr" class="py-name" href="#" onclick="return doclink('link-80', 'hasattr', 'link-41');">hasattr</a></tt><tt class="py-op">(</tt><tt class="py-name">element</tt><tt class="py-op">,</tt> <tt class="py-string">'getnext'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
386 <a name="L178"></a><tt class="py-lineno">178</tt>  <tt class="py-line">            <tt class="py-name">sibling</tt> <tt class="py-op">=</tt> <tt class="py-name">element</tt><tt class="py-op">.</tt><tt id="link-81" class="py-name" targets="Method lxml.etree._Element.getnext()=lxml.etree._Element-class.html#getnext,Method lxml.etree._ReadOnlyProxy.getnext()=lxml.etree._ReadOnlyProxy-class.html#getnext"><a title="lxml.etree._Element.getnext
387 lxml.etree._ReadOnlyProxy.getnext" class="py-name" href="#" onclick="return doclink('link-81', 'getnext', 'link-81');">getnext</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
388 <a name="L179"></a><tt class="py-lineno">179</tt>  <tt class="py-line">            <tt class="py-keyword">while</tt> <tt class="py-name">getattr</tt><tt class="py-op">(</tt><tt class="py-name">sibling</tt><tt class="py-op">,</tt> <tt class="py-string">'tag'</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">)</tt> <tt class="py-keyword">is</tt> <tt class="py-name">ProcessingInstruction</tt><tt class="py-op">:</tt> </tt>
389 <a name="L180"></a><tt class="py-lineno">180</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-82" class="py-name"><a title="lxml.sax.ElementTreeProducer._recursive_saxify" class="py-name" href="#" onclick="return doclink('link-82', '_recursive_saxify', 'link-78');">_recursive_saxify</a></tt><tt class="py-op">(</tt><tt class="py-name">sibling</tt><tt class="py-op">,</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">)</tt> </tt>
390 <a name="L181"></a><tt class="py-lineno">181</tt>  <tt class="py-line">                <tt class="py-name">sibling</tt> <tt class="py-op">=</tt> <tt class="py-name">sibling</tt><tt class="py-op">.</tt><tt id="link-83" class="py-name"><a title="lxml.etree._Element.getnext
391 lxml.etree._ReadOnlyProxy.getnext" class="py-name" href="#" onclick="return doclink('link-83', 'getnext', 'link-81');">getnext</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
392 <a name="L182"></a><tt class="py-lineno">182</tt>  <tt class="py-line"> </tt>
393 <a name="L183"></a><tt class="py-lineno">183</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_content_handler</tt><tt class="py-op">.</tt><tt id="link-84" class="py-name" targets="Method lxml.sax.ElementTreeContentHandler.endDocument()=lxml.sax.ElementTreeContentHandler-class.html#endDocument"><a title="lxml.sax.ElementTreeContentHandler.endDocument" class="py-name" href="#" onclick="return doclink('link-84', 'endDocument', 'link-84');">endDocument</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
394 </div><a name="L184"></a><tt class="py-lineno">184</tt>  <tt class="py-line"> </tt>
395 <a name="ElementTreeProducer._recursive_saxify"></a><div id="ElementTreeProducer._recursive_saxify-def"><a name="L185"></a><tt class="py-lineno">185</tt> <a class="py-toggle" href="#" id="ElementTreeProducer._recursive_saxify-toggle" onclick="return toggle('ElementTreeProducer._recursive_saxify');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax.ElementTreeProducer-class.html#_recursive_saxify">_recursive_saxify</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">element</tt><tt class="py-op">,</tt> <tt class="py-param">prefixes</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
396 </div><div id="ElementTreeProducer._recursive_saxify-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeProducer._recursive_saxify-expanded"><a name="L186"></a><tt class="py-lineno">186</tt>  <tt class="py-line">        <tt class="py-name">content_handler</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_content_handler</tt> </tt>
397 <a name="L187"></a><tt class="py-lineno">187</tt>  <tt class="py-line">        <tt id="link-85" class="py-name"><a title="lxml.etree._Comment.tag
398 lxml.etree._Element.tag
399 lxml.etree._Entity.tag
400 lxml.etree._ProcessingInstruction.tag
401 lxml.etree._ReadOnlyProxy.tag
402 lxml.tests.test_xpathevaluator.tag
403 xml.etree.ElementTree.Element.tag" class="py-name" href="#" onclick="return doclink('link-85', 'tag', 'link-11');">tag</a></tt> <tt class="py-op">=</tt> <tt class="py-name">element</tt><tt class="py-op">.</tt><tt id="link-86" class="py-name"><a title="lxml.etree._Comment.tag
404 lxml.etree._Element.tag
405 lxml.etree._Entity.tag
406 lxml.etree._ProcessingInstruction.tag
407 lxml.etree._ReadOnlyProxy.tag
408 lxml.tests.test_xpathevaluator.tag
409 xml.etree.ElementTree.Element.tag" class="py-name" href="#" onclick="return doclink('link-86', 'tag', 'link-11');">tag</a></tt> </tt>
410 <a name="L188"></a><tt class="py-lineno">188</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-87" class="py-name"><a title="lxml.etree._Comment.tag
411 lxml.etree._Element.tag
412 lxml.etree._Entity.tag
413 lxml.etree._ProcessingInstruction.tag
414 lxml.etree._ReadOnlyProxy.tag
415 lxml.tests.test_xpathevaluator.tag
416 xml.etree.ElementTree.Element.tag" class="py-name" href="#" onclick="return doclink('link-87', 'tag', 'link-11');">tag</a></tt> <tt class="py-keyword">is</tt> <tt id="link-88" class="py-name"><a title="lxml.etree.Comment" class="py-name" href="#" onclick="return doclink('link-88', 'Comment', 'link-10');">Comment</a></tt> <tt class="py-keyword">or</tt> <tt id="link-89" class="py-name"><a title="lxml.etree._Comment.tag
417 lxml.etree._Element.tag
418 lxml.etree._Entity.tag
419 lxml.etree._ProcessingInstruction.tag
420 lxml.etree._ReadOnlyProxy.tag
421 lxml.tests.test_xpathevaluator.tag
422 xml.etree.ElementTree.Element.tag" class="py-name" href="#" onclick="return doclink('link-89', 'tag', 'link-11');">tag</a></tt> <tt class="py-keyword">is</tt> <tt class="py-name">ProcessingInstruction</tt><tt class="py-op">:</tt> </tt>
423 <a name="L189"></a><tt class="py-lineno">189</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt id="link-90" class="py-name"><a title="lxml.etree._Comment.tag
424 lxml.etree._Element.tag
425 lxml.etree._Entity.tag
426 lxml.etree._ProcessingInstruction.tag
427 lxml.etree._ReadOnlyProxy.tag
428 lxml.tests.test_xpathevaluator.tag
429 xml.etree.ElementTree.Element.tag" class="py-name" href="#" onclick="return doclink('link-90', 'tag', 'link-11');">tag</a></tt> <tt class="py-keyword">is</tt> <tt class="py-name">ProcessingInstruction</tt><tt class="py-op">:</tt> </tt>
430 <a name="L190"></a><tt class="py-lineno">190</tt>  <tt class="py-line">                <tt class="py-name">content_handler</tt><tt class="py-op">.</tt><tt id="link-91" class="py-name" targets="Method lxml.sax.ElementTreeContentHandler.processingInstruction()=lxml.sax.ElementTreeContentHandler-class.html#processingInstruction"><a title="lxml.sax.ElementTreeContentHandler.processingInstruction" class="py-name" href="#" onclick="return doclink('link-91', 'processingInstruction', 'link-91');">processingInstruction</a></tt><tt class="py-op">(</tt> </tt>
431 <a name="L191"></a><tt class="py-lineno">191</tt>  <tt class="py-line">                    <tt class="py-name">element</tt><tt class="py-op">.</tt><tt id="link-92" class="py-name"><a title="lxml.etree._BaseParser.target
432 lxml.etree._ModifyContentOnlyPIProxy.target
433 lxml.etree._ProcessingInstruction.target
434 lxml.etree._ReadOnlyPIProxy.target" class="py-name" href="#" onclick="return doclink('link-92', 'target', 'link-47');">target</a></tt><tt class="py-op">,</tt> <tt class="py-name">element</tt><tt class="py-op">.</tt><tt id="link-93" class="py-name"><a title="lxml.etree.QName.text
435 lxml.etree._AppendOnlyElementProxy.text
436 lxml.etree._Element.text
437 lxml.etree._Entity.text
438 lxml.etree._ModifyContentOnlyProxy.text
439 lxml.etree._ReadOnlyEntityProxy.text
440 lxml.etree._ReadOnlyProxy.text
441 lxml.etree.__ContentOnlyElement.text
442 lxml.objectify.ObjectifiedElement.text
443 xml.etree.ElementTree.Element.text" class="py-name" href="#" onclick="return doclink('link-93', 'text', 'link-66');">text</a></tt><tt class="py-op">)</tt> </tt>
444 <a name="L192"></a><tt class="py-lineno">192</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">element</tt><tt class="py-op">.</tt><tt id="link-94" class="py-name"><a title="lxml.etree._Element.tail
445 lxml.etree._ReadOnlyProxy.tail
446 xml.etree.ElementTree.Element.tail" class="py-name" href="#" onclick="return doclink('link-94', 'tail', 'link-63');">tail</a></tt><tt class="py-op">:</tt> </tt>
447 <a name="L193"></a><tt class="py-lineno">193</tt>  <tt class="py-line">                <tt class="py-name">content_handler</tt><tt class="py-op">.</tt><tt id="link-95" class="py-name"><a title="lxml.sax.ElementTreeContentHandler.characters" class="py-name" href="#" onclick="return doclink('link-95', 'characters', 'link-69');">characters</a></tt><tt class="py-op">(</tt><tt class="py-name">element</tt><tt class="py-op">.</tt><tt id="link-96" class="py-name"><a title="lxml.etree._Element.tail
448 lxml.etree._ReadOnlyProxy.tail
449 xml.etree.ElementTree.Element.tail" class="py-name" href="#" onclick="return doclink('link-96', 'tail', 'link-63');">tail</a></tt><tt class="py-op">)</tt> </tt>
450 <a name="L194"></a><tt class="py-lineno">194</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> </tt>
451 <a name="L195"></a><tt class="py-lineno">195</tt>  <tt class="py-line"> </tt>
452 <a name="L196"></a><tt class="py-lineno">196</tt>  <tt class="py-line">        <tt class="py-name">new_prefixes</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
453 <a name="L197"></a><tt class="py-lineno">197</tt>  <tt class="py-line">        <tt class="py-name">build_qname</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-97" class="py-name" targets="Method lxml.sax.ElementTreeProducer._build_qname()=lxml.sax.ElementTreeProducer-class.html#_build_qname"><a title="lxml.sax.ElementTreeProducer._build_qname" class="py-name" href="#" onclick="return doclink('link-97', '_build_qname', 'link-97');">_build_qname</a></tt> </tt>
454 <a name="L198"></a><tt class="py-lineno">198</tt>  <tt class="py-line">        <tt class="py-name">attribs</tt> <tt class="py-op">=</tt> <tt class="py-name">element</tt><tt class="py-op">.</tt><tt id="link-98" class="py-name"><a title="lxml.etree._Attrib.items
455 lxml.etree._Element.items
456 lxml.etree._IDDict.items
457 lxml.etree._NamespaceRegistry.items
458 lxml.etree._ReadOnlyElementProxy.items
459 lxml.etree.__ContentOnlyElement.items" class="py-name" href="#" onclick="return doclink('link-98', 'items', 'link-38');">items</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
460 <a name="L199"></a><tt class="py-lineno">199</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">attribs</tt><tt class="py-op">:</tt> </tt>
461 <a name="L200"></a><tt class="py-lineno">200</tt>  <tt class="py-line">            <tt class="py-name">attr_values</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
462 <a name="L201"></a><tt class="py-lineno">201</tt>  <tt class="py-line">            <tt class="py-name">attr_qnames</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
463 <a name="L202"></a><tt class="py-lineno">202</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">attr_ns_name</tt><tt class="py-op">,</tt> <tt id="link-99" class="py-name"><a title="lxml.html.CheckboxGroup.value
464 lxml.html.InputElement.value
465 lxml.html.RadioGroup.value
466 lxml.html.SelectElement.value
467 lxml.html.TextareaElement.value" class="py-name" href="#" onclick="return doclink('link-99', 'value', 'link-39');">value</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">attribs</tt><tt class="py-op">:</tt> </tt>
468 <a name="L203"></a><tt class="py-lineno">203</tt>  <tt class="py-line">                <tt class="py-name">attr_ns_tuple</tt> <tt class="py-op">=</tt> <tt id="link-100" class="py-name" targets="Function lxml.sax._getNsTag()=lxml.sax-module.html#_getNsTag"><a title="lxml.sax._getNsTag" class="py-name" href="#" onclick="return doclink('link-100', '_getNsTag', 'link-100');">_getNsTag</a></tt><tt class="py-op">(</tt><tt class="py-name">attr_ns_name</tt><tt class="py-op">)</tt> </tt>
469 <a name="L204"></a><tt class="py-lineno">204</tt>  <tt class="py-line">                <tt class="py-name">attr_values</tt><tt class="py-op">[</tt><tt class="py-name">attr_ns_tuple</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-101" class="py-name"><a title="lxml.html.CheckboxGroup.value
470 lxml.html.InputElement.value
471 lxml.html.RadioGroup.value
472 lxml.html.SelectElement.value
473 lxml.html.TextareaElement.value" class="py-name" href="#" onclick="return doclink('link-101', 'value', 'link-39');">value</a></tt> </tt>
474 <a name="L205"></a><tt class="py-lineno">205</tt>  <tt class="py-line">                <tt class="py-name">attr_qnames</tt><tt class="py-op">[</tt><tt class="py-name">attr_ns_tuple</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">build_qname</tt><tt class="py-op">(</tt> </tt>
475 <a name="L206"></a><tt class="py-lineno">206</tt>  <tt class="py-line">                    <tt class="py-name">attr_ns_tuple</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-name">attr_ns_tuple</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-name">prefixes</tt><tt class="py-op">,</tt> <tt class="py-name">new_prefixes</tt><tt class="py-op">)</tt> </tt>
476 <a name="L207"></a><tt class="py-lineno">207</tt>  <tt class="py-line">            <tt class="py-name">sax_attributes</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_attr_class</tt><tt class="py-op">(</tt><tt class="py-name">attr_values</tt><tt class="py-op">,</tt> <tt class="py-name">attr_qnames</tt><tt class="py-op">)</tt> </tt>
477 <a name="L208"></a><tt class="py-lineno">208</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
478 <a name="L209"></a><tt class="py-lineno">209</tt>  <tt class="py-line">            <tt class="py-name">sax_attributes</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_empty_attributes</tt> </tt>
479 <a name="L210"></a><tt class="py-lineno">210</tt>  <tt class="py-line"> </tt>
480 <a name="L211"></a><tt class="py-lineno">211</tt>  <tt class="py-line">        <tt class="py-name">ns_uri</tt><tt class="py-op">,</tt> <tt class="py-name">local_name</tt> <tt class="py-op">=</tt> <tt id="link-102" class="py-name"><a title="lxml.sax._getNsTag" class="py-name" href="#" onclick="return doclink('link-102', '_getNsTag', 'link-100');">_getNsTag</a></tt><tt class="py-op">(</tt><tt id="link-103" class="py-name"><a title="lxml.etree._Comment.tag
481 lxml.etree._Element.tag
482 lxml.etree._Entity.tag
483 lxml.etree._ProcessingInstruction.tag
484 lxml.etree._ReadOnlyProxy.tag
485 lxml.tests.test_xpathevaluator.tag
486 xml.etree.ElementTree.Element.tag" class="py-name" href="#" onclick="return doclink('link-103', 'tag', 'link-11');">tag</a></tt><tt class="py-op">)</tt> </tt>
487 <a name="L212"></a><tt class="py-lineno">212</tt>  <tt class="py-line">        <tt class="py-name">qname</tt> <tt class="py-op">=</tt> <tt class="py-name">build_qname</tt><tt class="py-op">(</tt><tt class="py-name">ns_uri</tt><tt class="py-op">,</tt> <tt class="py-name">local_name</tt><tt class="py-op">,</tt> <tt class="py-name">prefixes</tt><tt class="py-op">,</tt> <tt class="py-name">new_prefixes</tt><tt class="py-op">)</tt> </tt>
488 <a name="L213"></a><tt class="py-lineno">213</tt>  <tt class="py-line"> </tt>
489 <a name="L214"></a><tt class="py-lineno">214</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt id="link-104" class="py-name"><a title="lxml.etree._Element.prefix
490 lxml.etree._ReadOnlyElementProxy.prefix
491 lxml.etree._XPathFunctionNamespaceRegistry.prefix" class="py-name" href="#" onclick="return doclink('link-104', 'prefix', 'link-24');">prefix</a></tt><tt class="py-op">,</tt> <tt id="link-105" class="py-name"><a title="lxml.tests.test_xpathevaluator.uri" class="py-name" href="#" onclick="return doclink('link-105', 'uri', 'link-25');">uri</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">new_prefixes</tt><tt class="py-op">:</tt> </tt>
492 <a name="L215"></a><tt class="py-lineno">215</tt>  <tt class="py-line">            <tt class="py-name">content_handler</tt><tt class="py-op">.</tt><tt id="link-106" class="py-name" targets="Method lxml.sax.ElementTreeContentHandler.startPrefixMapping()=lxml.sax.ElementTreeContentHandler-class.html#startPrefixMapping"><a title="lxml.sax.ElementTreeContentHandler.startPrefixMapping" class="py-name" href="#" onclick="return doclink('link-106', 'startPrefixMapping', 'link-106');">startPrefixMapping</a></tt><tt class="py-op">(</tt><tt id="link-107" class="py-name"><a title="lxml.etree._Element.prefix
493 lxml.etree._ReadOnlyElementProxy.prefix
494 lxml.etree._XPathFunctionNamespaceRegistry.prefix" class="py-name" href="#" onclick="return doclink('link-107', 'prefix', 'link-24');">prefix</a></tt><tt class="py-op">,</tt> <tt id="link-108" class="py-name"><a title="lxml.tests.test_xpathevaluator.uri" class="py-name" href="#" onclick="return doclink('link-108', 'uri', 'link-25');">uri</a></tt><tt class="py-op">)</tt> </tt>
495 <a name="L216"></a><tt class="py-lineno">216</tt>  <tt class="py-line">        <tt class="py-name">content_handler</tt><tt class="py-op">.</tt><tt id="link-109" class="py-name"><a title="lxml.sax.ElementTreeContentHandler.startElementNS" class="py-name" href="#" onclick="return doclink('link-109', 'startElementNS', 'link-57');">startElementNS</a></tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">ns_uri</tt><tt class="py-op">,</tt> <tt class="py-name">local_name</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
496 <a name="L217"></a><tt class="py-lineno">217</tt>  <tt class="py-line">                                       <tt class="py-name">qname</tt><tt class="py-op">,</tt> <tt class="py-name">sax_attributes</tt><tt class="py-op">)</tt> </tt>
497 <a name="L218"></a><tt class="py-lineno">218</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">element</tt><tt class="py-op">.</tt><tt id="link-110" class="py-name"><a title="lxml.etree.QName.text
498 lxml.etree._AppendOnlyElementProxy.text
499 lxml.etree._Element.text
500 lxml.etree._Entity.text
501 lxml.etree._ModifyContentOnlyProxy.text
502 lxml.etree._ReadOnlyEntityProxy.text
503 lxml.etree._ReadOnlyProxy.text
504 lxml.etree.__ContentOnlyElement.text
505 lxml.objectify.ObjectifiedElement.text
506 xml.etree.ElementTree.Element.text" class="py-name" href="#" onclick="return doclink('link-110', 'text', 'link-66');">text</a></tt><tt class="py-op">:</tt> </tt>
507 <a name="L219"></a><tt class="py-lineno">219</tt>  <tt class="py-line">            <tt class="py-name">content_handler</tt><tt class="py-op">.</tt><tt id="link-111" class="py-name"><a title="lxml.sax.ElementTreeContentHandler.characters" class="py-name" href="#" onclick="return doclink('link-111', 'characters', 'link-69');">characters</a></tt><tt class="py-op">(</tt><tt class="py-name">element</tt><tt class="py-op">.</tt><tt id="link-112" class="py-name"><a title="lxml.etree.QName.text
508 lxml.etree._AppendOnlyElementProxy.text
509 lxml.etree._Element.text
510 lxml.etree._Entity.text
511 lxml.etree._ModifyContentOnlyProxy.text
512 lxml.etree._ReadOnlyEntityProxy.text
513 lxml.etree._ReadOnlyProxy.text
514 lxml.etree.__ContentOnlyElement.text
515 lxml.objectify.ObjectifiedElement.text
516 xml.etree.ElementTree.Element.text" class="py-name" href="#" onclick="return doclink('link-112', 'text', 'link-66');">text</a></tt><tt class="py-op">)</tt> </tt>
517 <a name="L220"></a><tt class="py-lineno">220</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">child</tt> <tt class="py-keyword">in</tt> <tt class="py-name">element</tt><tt class="py-op">:</tt> </tt>
518 <a name="L221"></a><tt class="py-lineno">221</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-113" class="py-name"><a title="lxml.sax.ElementTreeProducer._recursive_saxify" class="py-name" href="#" onclick="return doclink('link-113', '_recursive_saxify', 'link-78');">_recursive_saxify</a></tt><tt class="py-op">(</tt><tt class="py-name">child</tt><tt class="py-op">,</tt> <tt class="py-name">prefixes</tt><tt class="py-op">)</tt> </tt>
519 <a name="L222"></a><tt class="py-lineno">222</tt>  <tt class="py-line">        <tt class="py-name">content_handler</tt><tt class="py-op">.</tt><tt id="link-114" class="py-name"><a title="lxml.sax.ElementTreeContentHandler.endElementNS" class="py-name" href="#" onclick="return doclink('link-114', 'endElementNS', 'link-60');">endElementNS</a></tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">ns_uri</tt><tt class="py-op">,</tt> <tt class="py-name">local_name</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">qname</tt><tt class="py-op">)</tt> </tt>
520 <a name="L223"></a><tt class="py-lineno">223</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt id="link-115" class="py-name"><a title="lxml.etree._Element.prefix
521 lxml.etree._ReadOnlyElementProxy.prefix
522 lxml.etree._XPathFunctionNamespaceRegistry.prefix" class="py-name" href="#" onclick="return doclink('link-115', 'prefix', 'link-24');">prefix</a></tt><tt class="py-op">,</tt> <tt id="link-116" class="py-name"><a title="lxml.tests.test_xpathevaluator.uri" class="py-name" href="#" onclick="return doclink('link-116', 'uri', 'link-25');">uri</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">new_prefixes</tt><tt class="py-op">:</tt> </tt>
523 <a name="L224"></a><tt class="py-lineno">224</tt>  <tt class="py-line">            <tt class="py-name">content_handler</tt><tt class="py-op">.</tt><tt id="link-117" class="py-name" targets="Method lxml.sax.ElementTreeContentHandler.endPrefixMapping()=lxml.sax.ElementTreeContentHandler-class.html#endPrefixMapping"><a title="lxml.sax.ElementTreeContentHandler.endPrefixMapping" class="py-name" href="#" onclick="return doclink('link-117', 'endPrefixMapping', 'link-117');">endPrefixMapping</a></tt><tt class="py-op">(</tt><tt id="link-118" class="py-name"><a title="lxml.etree._Element.prefix
524 lxml.etree._ReadOnlyElementProxy.prefix
525 lxml.etree._XPathFunctionNamespaceRegistry.prefix" class="py-name" href="#" onclick="return doclink('link-118', 'prefix', 'link-24');">prefix</a></tt><tt class="py-op">)</tt> </tt>
526 <a name="L225"></a><tt class="py-lineno">225</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">element</tt><tt class="py-op">.</tt><tt id="link-119" class="py-name"><a title="lxml.etree._Element.tail
527 lxml.etree._ReadOnlyProxy.tail
528 xml.etree.ElementTree.Element.tail" class="py-name" href="#" onclick="return doclink('link-119', 'tail', 'link-63');">tail</a></tt><tt class="py-op">:</tt> </tt>
529 <a name="L226"></a><tt class="py-lineno">226</tt>  <tt class="py-line">            <tt class="py-name">content_handler</tt><tt class="py-op">.</tt><tt id="link-120" class="py-name"><a title="lxml.sax.ElementTreeContentHandler.characters" class="py-name" href="#" onclick="return doclink('link-120', 'characters', 'link-69');">characters</a></tt><tt class="py-op">(</tt><tt class="py-name">element</tt><tt class="py-op">.</tt><tt id="link-121" class="py-name"><a title="lxml.etree._Element.tail
530 lxml.etree._ReadOnlyProxy.tail
531 xml.etree.ElementTree.Element.tail" class="py-name" href="#" onclick="return doclink('link-121', 'tail', 'link-63');">tail</a></tt><tt class="py-op">)</tt> </tt>
532 </div><a name="L227"></a><tt class="py-lineno">227</tt>  <tt class="py-line"> </tt>
533 <a name="ElementTreeProducer._build_qname"></a><div id="ElementTreeProducer._build_qname-def"><a name="L228"></a><tt class="py-lineno">228</tt> <a class="py-toggle" href="#" id="ElementTreeProducer._build_qname-toggle" onclick="return toggle('ElementTreeProducer._build_qname');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax.ElementTreeProducer-class.html#_build_qname">_build_qname</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">ns_uri</tt><tt class="py-op">,</tt> <tt class="py-param">local_name</tt><tt class="py-op">,</tt> <tt class="py-param">prefixes</tt><tt class="py-op">,</tt> <tt class="py-param">new_prefixes</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
534 </div><div id="ElementTreeProducer._build_qname-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeProducer._build_qname-expanded"><a name="L229"></a><tt class="py-lineno">229</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">ns_uri</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
535 <a name="L230"></a><tt class="py-lineno">230</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">local_name</tt> </tt>
536 <a name="L231"></a><tt class="py-lineno">231</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
537 <a name="L232"></a><tt class="py-lineno">232</tt>  <tt class="py-line">            <tt id="link-122" class="py-name"><a title="lxml.etree._Element.prefix
538 lxml.etree._ReadOnlyElementProxy.prefix
539 lxml.etree._XPathFunctionNamespaceRegistry.prefix" class="py-name" href="#" onclick="return doclink('link-122', 'prefix', 'link-24');">prefix</a></tt> <tt class="py-op">=</tt> <tt class="py-name">prefixes</tt><tt class="py-op">[</tt><tt class="py-name">ns_uri</tt><tt class="py-op">]</tt> </tt>
540 <a name="L233"></a><tt class="py-lineno">233</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">KeyError</tt><tt class="py-op">:</tt> </tt>
541 <a name="L234"></a><tt class="py-lineno">234</tt>  <tt class="py-line">            <tt id="link-123" class="py-name"><a title="lxml.etree._Element.prefix
542 lxml.etree._ReadOnlyElementProxy.prefix
543 lxml.etree._XPathFunctionNamespaceRegistry.prefix" class="py-name" href="#" onclick="return doclink('link-123', 'prefix', 'link-24');">prefix</a></tt> <tt class="py-op">=</tt> <tt class="py-name">prefixes</tt><tt class="py-op">[</tt><tt class="py-name">ns_uri</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-string">'ns%02d'</tt> <tt class="py-op">%</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">prefixes</tt><tt class="py-op">)</tt> </tt>
544 <a name="L235"></a><tt class="py-lineno">235</tt>  <tt class="py-line">            <tt class="py-name">new_prefixes</tt><tt class="py-op">.</tt><tt id="link-124" class="py-name"><a title="lxml.etree._AppendOnlyElementProxy.append
545 lxml.etree._Element.append
546 lxml.etree._OpaqueDocumentWrapper.append
547 lxml.etree.__ContentOnlyElement.append" class="py-name" href="#" onclick="return doclink('link-124', 'append', 'link-27');">append</a></tt><tt class="py-op">(</tt> <tt class="py-op">(</tt><tt id="link-125" class="py-name"><a title="lxml.etree._Element.prefix
548 lxml.etree._ReadOnlyElementProxy.prefix
549 lxml.etree._XPathFunctionNamespaceRegistry.prefix" class="py-name" href="#" onclick="return doclink('link-125', 'prefix', 'link-24');">prefix</a></tt><tt class="py-op">,</tt> <tt class="py-name">ns_uri</tt><tt class="py-op">)</tt> <tt class="py-op">)</tt> </tt>
550 <a name="L236"></a><tt class="py-lineno">236</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt id="link-126" class="py-name"><a title="lxml.etree._Element.prefix
551 lxml.etree._ReadOnlyElementProxy.prefix
552 lxml.etree._XPathFunctionNamespaceRegistry.prefix" class="py-name" href="#" onclick="return doclink('link-126', 'prefix', 'link-24');">prefix</a></tt> <tt class="py-op">+</tt> <tt class="py-string">':'</tt> <tt class="py-op">+</tt> <tt class="py-name">local_name</tt> </tt>
553 </div></div><a name="L237"></a><tt class="py-lineno">237</tt>  <tt class="py-line"> </tt>
554 <a name="saxify"></a><div id="saxify-def"><a name="L238"></a><tt class="py-lineno">238</tt> <a class="py-toggle" href="#" id="saxify-toggle" onclick="return toggle('saxify');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.sax-module.html#saxify">saxify</a><tt class="py-op">(</tt><tt class="py-param">element_or_tree</tt><tt class="py-op">,</tt> <tt class="py-param">content_handler</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
555 </div><div id="saxify-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="saxify-expanded"><a name="L239"></a><tt class="py-lineno">239</tt>  <tt class="py-line">    <tt class="py-docstring">"""One-shot helper to generate SAX events from an XML tree and fire</tt> </tt>
556 <a name="L240"></a><tt class="py-lineno">240</tt>  <tt class="py-line"><tt class="py-docstring">    them against a SAX ContentHandler.</tt> </tt>
557 <a name="L241"></a><tt class="py-lineno">241</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
558 <a name="L242"></a><tt class="py-lineno">242</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt id="link-127" class="py-name" targets="Class lxml.sax.ElementTreeProducer=lxml.sax.ElementTreeProducer-class.html"><a title="lxml.sax.ElementTreeProducer" class="py-name" href="#" onclick="return doclink('link-127', 'ElementTreeProducer', 'link-127');">ElementTreeProducer</a></tt><tt class="py-op">(</tt><tt class="py-name">element_or_tree</tt><tt class="py-op">,</tt> <tt class="py-name">content_handler</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-128" class="py-name" targets="Method lxml.sax.ElementTreeProducer.saxify()=lxml.sax.ElementTreeProducer-class.html#saxify,Function lxml.sax.saxify()=lxml.sax-module.html#saxify"><a title="lxml.sax.ElementTreeProducer.saxify
559 lxml.sax.saxify" class="py-name" href="#" onclick="return doclink('link-128', 'saxify', 'link-128');">saxify</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
560 </div><a name="L243"></a><tt class="py-lineno">243</tt>  <tt class="py-line"> </tt><script type="text/javascript">
561 <!--
562 expandto(location.href);
563 // -->
564 </script>
565 </pre>
566 <br />
567 <!-- ==================== NAVIGATION BAR ==================== -->
568 <table class="navbar" border="0" width="100%" cellpadding="0"
569        bgcolor="#a0c0ff" cellspacing="0">
570   <tr valign="middle">
571   <!-- Home link -->
572       <th>&nbsp;&nbsp;&nbsp;<a
573         href="lxml-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
574
575   <!-- Tree link -->
576       <th>&nbsp;&nbsp;&nbsp;<a
577         href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
578
579   <!-- Index link -->
580       <th>&nbsp;&nbsp;&nbsp;<a
581         href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
582
583   <!-- Help link -->
584       <th>&nbsp;&nbsp;&nbsp;<a
585         href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
586
587   <!-- Project homepage -->
588       <th class="navbar" align="right" width="100%">
589         <table border="0" cellpadding="0" cellspacing="0">
590           <tr><th class="navbar" align="center"
591             ><a class="navbar" target="_top" href="/">lxml API</a></th>
592           </tr></table></th>
593   </tr>
594 </table>
595 <table border="0" cellpadding="0" cellspacing="0" width="100%%">
596   <tr>
597     <td align="left" class="footer">
598     Generated by Epydoc 3.0.1 on Tue Jul 31 10:14:23 2012
599     </td>
600     <td align="right" class="footer">
601       <a target="mainFrame" href="http://epydoc.sourceforge.net"
602         >http://epydoc.sourceforge.net</a>
603     </td>
604   </tr>
605 </table>
606
607 <script type="text/javascript">
608   <!--
609   // Private objects are initially displayed (because if
610   // javascript is turned off then we want them to be
611   // visible); but by default, we want to hide them.  So hide
612   // them unless we have a cookie that says to show them.
613   checkCookie();
614   // -->
615 </script>
616 </body>
617 </html>