1 <?xml version="1.0" encoding="utf-8" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
7 <title>lxml changelog</title>
8 <link rel="stylesheet" href="style.css" type="text/css" />
11 <div class="document" id="lxml-changelog">
12 <h1 class="title">lxml changelog</h1>
14 <div class="section" id="id1">
15 <h1>4.4.3 (2020-01-28)</h1>
16 <div class="section" id="bugs-fixed">
19 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1844674">LP#1844674</a>: <tt class="docutils literal">itertext()</tt> was missing tail text of comments and PIs since 4.4.0.</li>
23 <div class="section" id="id2">
24 <h1>4.4.2 (2019-11-25)</h1>
25 <div class="section" id="id3">
28 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1835708">LP#1835708</a>: <tt class="docutils literal">ElementInclude</tt> incorrectly rejected repeated non-recursive
29 includes as recursive.
30 Patch by Rainer Hausdorf.</li>
34 <div class="section" id="id4">
35 <h1>4.4.1 (2019-08-11)</h1>
36 <div class="section" id="id5">
39 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1838252">LP#1838252</a>: The order of an OrderedDict was lost in 4.4.0 when passing it as
40 attrib mapping during element creation.</li>
41 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1838521">LP#1838521</a>: The package metadata now lists the supported Python versions.</li>
45 <div class="section" id="id6">
46 <h1>4.4.0 (2019-07-27)</h1>
47 <div class="section" id="features-added">
48 <h2>Features added</h2>
50 <li><tt class="docutils literal">Element.clear()</tt> accepts a new keyword argument <tt class="docutils literal">keep_tail=True</tt> to clear
51 everything but the tail text. This is helpful in some document-style use cases
52 and for clearing the current element in <tt class="docutils literal">iterparse()</tt> and pull parsing.</li>
53 <li>When creating attributes or namespaces from a dict in Python 3.6+, lxml now
54 preserves the original insertion order of that dict, instead of always sorting
55 the items by name. A similar change was made for ElementTree in CPython 3.8.
56 See <a class="reference external" href="https://bugs.python.org/issue34160">https://bugs.python.org/issue34160</a></li>
57 <li>Integer elements in <tt class="docutils literal">lxml.objectify</tt> implement the <tt class="docutils literal">__index__()</tt> special method.</li>
58 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/269">GH#269</a>: Read-only elements in XSLT were missing the <tt class="docutils literal">nsmap</tt> property.
59 Original patch by Jan Pazdziora.</li>
60 <li>ElementInclude can now restrict the maximum inclusion depth via a <tt class="docutils literal">max_depth</tt>
61 argument to prevent content explosion. It is limited to 6 by default.</li>
62 <li>The <tt class="docutils literal">target</tt> object of the XMLParser can have <tt class="docutils literal">start_ns()</tt> and <tt class="docutils literal">end_ns()</tt>
63 callback methods to listen to namespace declarations.</li>
64 <li>The <tt class="docutils literal">TreeBuilder</tt> has new arguments <tt class="docutils literal">comment_factory</tt> and <tt class="docutils literal">pi_factory</tt> to
65 pass factories for creating comments and processing instructions, as well as
66 flag arguments <tt class="docutils literal">insert_comments</tt> and <tt class="docutils literal">insert_pis</tt> to discard them from the
67 tree when set to false.</li>
68 <li>A <a class="reference external" href="https://www.w3.org/TR/xml-c14n2/">C14N 2.0</a> implementation was added as
69 <tt class="docutils literal">etree.canonicalize()</tt>, a corresponding <tt class="docutils literal">C14NWriterTarget</tt> class, and
70 a <tt class="docutils literal">c14n2</tt> serialisation method.</li>
73 <div class="section" id="id7">
76 <li>When writing to file paths that contain the URL escape character '%', the file
77 path could wrongly be mangled by URL unescaping and thus write to a different
78 file or directory. Code that writes to file paths that are provided by untrusted
79 sources, but that must work with previous versions of lxml, should best either
80 reject paths that contain '%' characters, or otherwise make sure that the path
81 does not contain maliciously injected '%XX' URL hex escapes for paths like '../'.</li>
82 <li>Assigning to Element child slices with negative step could insert the slice at
83 the wrong position, starting too far on the left.</li>
84 <li>Assigning to Element child slices with overly large step size could take very
85 long, regardless of the length of the actual slice.</li>
86 <li>Assigning to Element child slices of the wrong size could sometimes fail to
87 raise a ValueError (like a list assignment would) and instead assign outside
88 of the original slice bounds or leave parts of it unreplaced.</li>
89 <li>The <tt class="docutils literal">comment</tt> and <tt class="docutils literal">pi</tt> events in <tt class="docutils literal">iterwalk()</tt> were never triggered, and
90 instead, comments and processing instructions in the tree were reported as
91 <tt class="docutils literal">start</tt> elements. Also, when walking an ElementTree (as opposed to its root
92 element), comments and PIs outside of the root element are now reported.</li>
93 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1827833">LP#1827833</a>: The RelaxNG compact syntax support was broken with recent versions
94 of <tt class="docutils literal">rnc2rng</tt>.</li>
95 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1758553">LP#1758553</a>: The HTML elements <tt class="docutils literal">source</tt> and <tt class="docutils literal">track</tt> were added to the list
96 of empty tags in <tt class="docutils literal">lxml.html.defs</tt>.</li>
97 <li>Registering a prefix other than "xml" for the XML namespace is now rejected.</li>
98 <li>Failing to write XSLT output to a file could raise a misleading exception.
99 It now raises <tt class="docutils literal">IOError</tt>.</li>
102 <div class="section" id="other-changes">
103 <h2>Other changes</h2>
105 <li>Support for Python 3.4 was removed.</li>
106 <li>When using <tt class="docutils literal"><span class="pre">Element.find*()</span></tt> with prefix-namespace mappings, the empty string
107 is now accepted to define a default namespace, in addition to the previously
108 supported <tt class="docutils literal">None</tt> prefix. Empty strings are more convenient since they keep
109 all prefix keys in a namespace dict strings, which simplifies sorting etc.</li>
110 <li>The <tt class="docutils literal">ElementTree.write_c14n()</tt> method has been deprecated in favour of the
111 long preferred <tt class="docutils literal">ElementTree.write(f, <span class="pre">method="c14n")</span></tt>. It will be removed
112 in a future release.</li>
116 <div class="section" id="id8">
117 <h1>4.3.5 (2019-07-27)</h1>
119 <li>Rebuilt with Cython 0.29.13 to support Python 3.8.</li>
122 <div class="section" id="id9">
123 <h1>4.3.4 (2019-06-10)</h1>
125 <li>Rebuilt with Cython 0.29.10 to support Python 3.8.</li>
128 <div class="section" id="id10">
129 <h1>4.3.3 (2019-03-26)</h1>
130 <div class="section" id="id11">
133 <li>Fix leak of output buffer and unclosed files in <tt class="docutils literal">_XSLTResultTree.write_output()</tt>.</li>
137 <div class="section" id="id12">
138 <h1>4.3.2 (2019-02-29)</h1>
139 <div class="section" id="id13">
142 <li>Crash in 4.3.1 when appending a child subtree with certain text nodes.</li>
145 <div class="section" id="id14">
146 <h2>Other changes</h2>
148 <li>Built with Cython 0.29.6.</li>
152 <div class="section" id="id15">
153 <h1>4.3.1 (2019-02-08)</h1>
154 <div class="section" id="id16">
157 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1814522">LP#1814522</a>: Crash when appending a child subtree that contains unsubstituted
158 entity references.</li>
161 <div class="section" id="id17">
162 <h2>Other changes</h2>
164 <li>Built with Cython 0.29.5.</li>
168 <div class="section" id="id18">
169 <h1>4.3.0 (2019-01-04)</h1>
170 <div class="section" id="id19">
171 <h2>Features added</h2>
173 <li>The module <tt class="docutils literal">lxml.sax</tt> is compiled using Cython in order to speed it up.</li>
174 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/267">GH#267</a>: <tt class="docutils literal">lxml.sax.ElementTreeProducer</tt> now preserves the namespace prefixes.
175 If two prefixes point to the same URI, the first prefix in alphabetical order
176 is used. Patch by Lennart Regebro.</li>
177 <li>Updated ISO-Schematron implementation to 2013 version (now MIT licensed)
178 and the corresponding schema to the 2016 version (with optional "properties").</li>
181 <div class="section" id="id20">
182 <h2>Other changes</h2>
184 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/270">GH#270</a>, <a class="reference external" href="https://github.com/lxml/lxml/issues/271">GH#271</a>: Support for Python 2.6 and 3.3 was removed.
185 Patch by hugovk.</li>
186 <li>The minimum dependency versions were raised to libxml2 2.9.2 and libxslt 1.1.27,
187 which were released in 2014 and 2012 respectively.</li>
188 <li>Built with Cython 0.29.2.</li>
192 <div class="section" id="id21">
193 <h1>4.2.6 (2019-01-02)</h1>
194 <div class="section" id="id22">
197 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1799755">LP#1799755</a>: Fix a DeprecationWarning in Py3.7+.</li>
198 <li>Import warnings in Python 3.6+ were resolved.</li>
202 <div class="section" id="id23">
203 <h1>4.2.5 (2018-09-09)</h1>
204 <div class="section" id="id24">
207 <li>Javascript URLs that used URL escaping were not removed by the HTML cleaner.
208 Security problem found by Omar Eissa. (CVE-2018-19787)</li>
212 <div class="section" id="id25">
213 <h1>4.2.4 (2018-08-03)</h1>
214 <div class="section" id="id26">
215 <h2>Features added</h2>
217 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/259">GH#259</a>: Allow using <tt class="docutils literal"><span class="pre">pkg-config</span></tt> for build configuration.
218 Patch by Patrick Griffis.</li>
221 <div class="section" id="id27">
224 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1773749">LP#1773749</a>, <a class="reference external" href="https://github.com/lxml/lxml/issues/268">GH#268</a>: Crash when moving an element to another document with
225 <tt class="docutils literal">Element.insert()</tt>.
226 Patch by Alexander Weggerle.</li>
230 <div class="section" id="id28">
231 <h1>4.2.3 (2018-06-27)</h1>
232 <div class="section" id="id29">
235 <li>Reverted <a class="reference external" href="https://github.com/lxml/lxml/issues/265">GH#265</a>: lxml links against zlib as a shared library again.</li>
239 <div class="section" id="id30">
240 <h1>4.2.2 (2018-06-22)</h1>
241 <div class="section" id="id31">
244 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/266">GH#266</a>: Fix sporadic crash during GC when parse-time schema validation is used
245 and the parser participates in a reference cycle.
246 Original patch by Julien Greard.</li>
247 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/265">GH#265</a>: lxml no longer links against zlib as a shared library, only on static builds.
248 Patch by Nehal J Wani.</li>
252 <div class="section" id="id33">
253 <h1>4.2.1 (2018-03-21)</h1>
254 <div class="section" id="id34">
257 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1755825">LP#1755825</a>: <tt class="docutils literal">iterwalk()</tt> failed to return the 'start' event for the initial
258 element if a tag selector is used.</li>
259 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1756314">LP#1756314</a>: Failure to import 4.2.0 into PyPy due to a missing library symbol.</li>
260 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1727864">LP#1727864</a>, <a class="reference external" href="https://github.com/lxml/lxml/issues/258">GH#258</a>: Add "-isysroot" linker option on MacOS as needed by XCode 9.</li>
264 <div class="section" id="id35">
265 <h1>4.2.0 (2018-03-13)</h1>
266 <div class="section" id="id36">
267 <h2>Features added</h2>
269 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/255">GH#255</a>: <tt class="docutils literal">SelectElement.value</tt> returns more standard-compliant and
270 browser-like defaults for non-multi-selects. If no option is selected, the
271 value of the first option is returned (instead of None). If multiple options
272 are selected, the value of the last one is returned (instead of that of the
273 first one). If no options are present (not standard-compliant)
274 <tt class="docutils literal">SelectElement.value</tt> still returns <tt class="docutils literal">None</tt>.</li>
275 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/261">GH#261</a>: The <tt class="docutils literal">HTMLParser()</tt> now supports the <tt class="docutils literal">huge_tree</tt> option.
276 Patch by stranac.</li>
279 <div class="section" id="id37">
282 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1551797">LP#1551797</a>: Some XSLT messages were not captured by the transform error log.</li>
283 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1737825">LP#1737825</a>: Crash at shutdown after an interrupted iterparse run with XMLSchema
287 <div class="section" id="id38">
288 <h2>Other changes</h2>
291 <div class="section" id="id39">
292 <h1>4.1.1 (2017-11-04)</h1>
294 <li>Rebuild with Cython 0.27.3 to improve support for Py3.7.</li>
297 <div class="section" id="id40">
298 <h1>4.1.0 (2017-10-13)</h1>
299 <div class="section" id="id41">
300 <h2>Features added</h2>
302 <li>ElementPath supports text predicates for current node, like "[.='text']".</li>
303 <li>ElementPath allows spaces in predicates.</li>
304 <li>Custom Element classes and XPath functions can now be registered with a
305 decorator rather than explicit dict assignments.</li>
306 <li>Static Linux wheels are now built with link time optimisation (LTO) enabled.
307 This should have a beneficial impact on the overall performance by providing
308 a tighter compiler integration between lxml and libxml2/libxslt.</li>
311 <div class="section" id="id42">
314 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1722776">LP#1722776</a>: Requesting non-Element objects like comments from a document with
315 <tt class="docutils literal">PythonElementClassLookup</tt> could fail with a TypeError.</li>
319 <div class="section" id="id43">
320 <h1>4.0.0 (2017-09-17)</h1>
321 <div class="section" id="id44">
322 <h2>Features added</h2>
324 <li>The ElementPath implementation is now compiled using Cython,
325 which speeds up the <tt class="docutils literal"><span class="pre">.find*()</span></tt> methods quite significantly.</li>
326 <li>The modules <tt class="docutils literal">lxml.builder</tt>, <tt class="docutils literal">lxml.html.diff</tt> and <tt class="docutils literal">lxml.html.clean</tt>
327 are also compiled using Cython in order to speed them up.</li>
328 <li><tt class="docutils literal">xmlfile()</tt> supports async coroutines using <tt class="docutils literal">async with</tt> and <tt class="docutils literal">await</tt>.</li>
329 <li><tt class="docutils literal">iterwalk()</tt> has a new method <tt class="docutils literal">skip_subtree()</tt> that prevents walking into
330 the descendants of the current element.</li>
331 <li><tt class="docutils literal">RelaxNG.from_rnc_string()</tt> accepts a <tt class="docutils literal">base_url</tt> argument to
332 allow relative resource lookups.</li>
333 <li>The XSLT result object has a new method <tt class="docutils literal">.write_output(file)</tt> that serialises
334 output data into a file according to the <tt class="docutils literal"><xsl:output></tt> configuration.</li>
337 <div class="section" id="id45">
340 <li><p class="first"><a class="reference external" href="https://github.com/lxml/lxml/issues/251">GH#251</a>: HTML comments were handled incorrectly by the soupparser.
341 Patch by mozbugbox.</p>
343 <li><p class="first"><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1654544">LP#1654544</a>: The html5parser no longer passes the <tt class="docutils literal">useChardet</tt> option
344 if the input is a Unicode string, unless explicitly requested. When parsing
345 files, the default is to enable it when a URL or file path is passed (because
346 the file is then opened in binary mode), and to disable it when reading from
347 a file(-like) object.</p>
348 <p>Note: This is a backwards incompatible change of the default configuration.
349 If your code parses byte strings/streams and depends on character detection,
350 please pass the option <tt class="docutils literal">guess_charset=True</tt> explicitly, which already worked
351 in older lxml versions.</p>
353 <li><p class="first"><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1703810">LP#1703810</a>: <tt class="docutils literal">etree.fromstring()</tt> failed to parse UTF-32 data with BOM.</p>
355 <li><p class="first"><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1526522">LP#1526522</a>: Some RelaxNG errors were not reported in the error log.</p>
357 <li><p class="first"><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1567526">LP#1567526</a>: Empty and plain text input raised a TypeError in soupparser.</p>
359 <li><p class="first"><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1710429">LP#1710429</a>: Uninitialised variable usage in HTML diff.</p>
361 <li><p class="first"><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1415643">LP#1415643</a>: The closing tags context manager in <tt class="docutils literal">xmlfile()</tt> could continue
362 to output end tags even after writing failed with an exception.</p>
364 <li><p class="first"><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1465357">LP#1465357</a>: <tt class="docutils literal">xmlfile.write()</tt> now accepts and ignores None as input argument.</p>
366 <li><p class="first">Compilation under Py3.7-pre failed due to a modified function signature.</p>
370 <div class="section" id="id46">
371 <h2>Other changes</h2>
373 <li>The main module source files were renamed from <tt class="docutils literal"><span class="pre">lxml.*.pyx</span></tt> to plain
374 <tt class="docutils literal">*.pyx</tt> (e.g. <tt class="docutils literal">etree.pyx</tt>) to simplify their handling in the build
375 process. Care was taken to keep the old header files as fallbacks for
376 code that compiles against the public C-API of lxml, but it might still
377 be worth validating that third-party code does not notice this change.</li>
381 <div class="section" id="id47">
382 <h1>3.8.0 (2017-06-03)</h1>
383 <div class="section" id="id48">
384 <h2>Features added</h2>
386 <li><tt class="docutils literal">ElementTree.write()</tt> has a new option <tt class="docutils literal">doctype</tt> that writes out a
387 doctype string before the serialisation, in the same way as <tt class="docutils literal">tostring()</tt>.</li>
388 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/220">GH#220</a>: <tt class="docutils literal">xmlfile</tt> allows switching output methods at an element level.
389 Patch by Burak Arslan.</li>
390 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1595781">LP#1595781</a>, <a class="reference external" href="https://github.com/lxml/lxml/issues/240">GH#240</a>: added a PyCapsule Python API and C-level API for
391 passing externally generated libxml2 documents into lxml.</li>
392 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/244">GH#244</a>: error log entries have a new property <tt class="docutils literal">path</tt> with an XPath
393 expression (if known, None otherwise) that points to the tree element
394 responsible for the error. Patch by Bob Kline.</li>
395 <li>The namespace prefix mapping that can be used in ElementPath now injects
396 a default namespace when passing a None prefix.</li>
399 <div class="section" id="id49">
402 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/238">GH#238</a>: Character escapes were not hex-encoded in the <tt class="docutils literal">xmlfile</tt> serialiser.
403 Patch by matejcik.</li>
404 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/229">GH#229</a>: fix for externally created XML documents. Patch by Theodore Dubois.</li>
405 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1665241">LP#1665241</a>, <a class="reference external" href="https://github.com/lxml/lxml/issues/228">GH#228</a>: Form data handling in lxml.html no longer strips the
406 option values specified in form attributes but only the text values.
407 Patch by Ashish Kulkarni.</li>
408 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1551797">LP#1551797</a>: revert previous fix for XSLT error logging as it breaks
409 multi-threaded XSLT processing.</li>
410 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1673355">LP#1673355</a>, <a class="reference external" href="https://github.com/lxml/lxml/issues/233">GH#233</a>: <tt class="docutils literal">fromstring()</tt> html5parser failed to parse byte strings.</li>
413 <div class="section" id="id51">
414 <h2>Other changes</h2>
416 <li>The previously undocumented <tt class="docutils literal">docstring</tt> option in <tt class="docutils literal">ElementTree.write()</tt>
417 produces a deprecation warning and will eventually be removed.</li>
421 <div class="section" id="id52">
422 <h1>3.7.4 (2017-??-??)</h1>
423 <div class="section" id="id53">
426 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1551797">LP#1551797</a>: revert previous fix for XSLT error logging as it breaks
427 multi-threaded XSLT processing.</li>
428 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1673355">LP#1673355</a>, <a class="reference external" href="https://github.com/lxml/lxml/issues/233">GH#233</a>: <tt class="docutils literal">fromstring()</tt> html5parser failed to parse byte strings.</li>
432 <div class="section" id="id57">
433 <h1>3.7.3 (2017-02-18)</h1>
434 <div class="section" id="id58">
437 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/218">GH#218</a> was ineffective in Python 3.</li>
438 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/222">GH#222</a>: <tt class="docutils literal">lxml.html.submit_form()</tt> failed in Python 3.
439 Patch by Jakub Wilk.</li>
443 <div class="section" id="id59">
444 <h1>3.7.2 (2017-01-08)</h1>
446 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/220">GH#220</a>: <tt class="docutils literal">xmlfile</tt> allows switching output methods at an element level.
447 Patch by Burak Arslan.</li>
449 <div class="section" id="id61">
452 <li>Work around installation problems in recent Python 2.7 versions
453 due to FTP download failures.</li>
454 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/219">GH#219</a>: <tt class="docutils literal">xmlfile.element()</tt> was not properly quoting attribute values.
455 Patch by Burak Arslan.</li>
456 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/218">GH#218</a>: <tt class="docutils literal">xmlfile.element()</tt> was not properly escaping text content of
457 script/style tags. Patch by Burak Arslan.</li>
461 <div class="section" id="id63">
462 <h1>3.7.1 (2016-12-23)</h1>
464 <li>No source changes, issued only to solve problems with the
465 binary packages released for 3.7.0.</li>
468 <div class="section" id="id64">
469 <h1>3.7.0 (2016-12-10)</h1>
470 <div class="section" id="id65">
471 <h2>Features added</h2>
473 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/217">GH#217</a>: <tt class="docutils literal">XMLSyntaxError</tt> now behaves more like its <tt class="docutils literal">SyntaxError</tt>
474 baseclass. Patch by Philipp A.</li>
475 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/216">GH#216</a>: <tt class="docutils literal">HTMLParser()</tt> now supports the same <tt class="docutils literal">collect_ids</tt> parameter
476 as <tt class="docutils literal">XMLParser()</tt>. Patch by Burak Arslan.</li>
477 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/210">GH#210</a>: Allow specifying a serialisation method in <tt class="docutils literal">xmlfile.write()</tt>.
478 Patch by Burak Arslan.</li>
479 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/203">GH#203</a>: New option <tt class="docutils literal">default_doctype</tt> in <tt class="docutils literal">HTMLParser</tt> that allows
480 disabling the automatic doctype creation. Patch by Shadab Zafar.</li>
481 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/201">GH#201</a>: Calling the method <tt class="docutils literal"><span class="pre">.set('attrname')</span></tt> without value argument
482 (or <tt class="docutils literal">None</tt>) on HTML elements creates an attribute without value that
483 serialises like <tt class="docutils literal"><div <span class="pre">attrname></div></span></tt>. Patch by Daniel Holth.</li>
484 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/197">GH#197</a>: Ignore form input fields in <tt class="docutils literal">form_values()</tt> when they are
485 marked as <tt class="docutils literal">disabled</tt> in HTML. Patch by Kristian Klemon.</li>
488 <div class="section" id="id66">
491 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/206">GH#206</a>: File name and line number were missing from XSLT error messages.
492 Patch by Marcus Brinkmann.</li>
495 <div class="section" id="id67">
496 <h2>Other changes</h2>
498 <li>Log entries no longer allow anything but plain string objects as message text
500 <li><tt class="docutils literal">zlib</tt> is included in the list of statically built libraries.</li>
504 <div class="section" id="id68">
505 <h1>3.6.4 (2016-08-20)</h1>
507 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/204">GH#204</a>, <a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1614693">LP#1614693</a>: build fix for MacOS-X.</li>
510 <div class="section" id="id69">
511 <h1>3.6.3 (2016-08-18)</h1>
513 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1614603">LP#1614603</a>: change linker flags to build multi-linux wheels</li>
516 <div class="section" id="id70">
517 <h1>3.6.2 (2016-08-18)</h1>
519 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1614603">LP#1614603</a>: release without source changes to provide cleanly built Linux wheels</li>
522 <div class="section" id="id72">
523 <h1>3.6.1 (2016-07-24)</h1>
524 <div class="section" id="id73">
525 <h2>Features added</h2>
527 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/180">GH#180</a>: Separate option <tt class="docutils literal">inline_style</tt> for Cleaner that only removes <tt class="docutils literal">style</tt>
528 attributes instead of all styles. Patch by Christian Pedersen.</li>
529 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/196">GH#196</a>: Windows build support for Python 3.5. Contribution by Maximilian Hils.</li>
532 <div class="section" id="id74">
535 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/199">GH#199</a>: Exclude <tt class="docutils literal">file</tt> fields from <tt class="docutils literal">FormElement.form_values</tt> (as browsers do).
536 Patch by Tomas Divis.</li>
537 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/198">GH#198</a>, <a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1568167">LP#1568167</a>: Try to provide base URL from <tt class="docutils literal">Resolver.resolve_string()</tt>.
538 Patch by Michael van Tellingen.</li>
539 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/191">GH#191</a>: More accurate float serialisation in <tt class="docutils literal">objectify.FloatElement</tt>.
540 Patch by Holger Joukl.</li>
541 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1551797">LP#1551797</a>: Repair XSLT error logging. Patch by Marcus Brinkmann.</li>
545 <div class="section" id="id76">
546 <h1>3.6.0 (2016-03-17)</h1>
547 <div class="section" id="id77">
548 <h2>Features added</h2>
550 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/187">GH#187</a>: Now supports (only) version 5.x and later of PyPy.
551 Patch by Armin Rigo.</li>
552 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/181">GH#181</a>: Direct support for <tt class="docutils literal">.rnc</tt> files in <cite>RelaxNG()</cite> if <tt class="docutils literal">rnc2rng</tt>
553 is installed. Patch by Dirkjan Ochtman.</li>
556 <div class="section" id="id78">
559 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/189">GH#189</a>: Static builds honour FTP proxy configurations when downloading
560 the external libs. Patch by Youhei Sakurai.</li>
561 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/186">GH#186</a>: Soupparser failed to process entities in Python 3.x.
562 Patch by Duncan Morris.</li>
563 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/185">GH#185</a>: Rare encoding related <tt class="docutils literal">TypeError</tt> on import was fixed.
564 Patch by Petr Demin.</li>
568 <div class="section" id="id79">
569 <h1>3.5.0 (2015-11-13)</h1>
570 <div class="section" id="id80">
573 <li>Unicode string results failed XPath queries in PyPy.</li>
574 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1497051">LP#1497051</a>: HTML target parser failed to terminate on exceptions
575 and continued parsing instead.</li>
576 <li>Deprecated API usage in doctestcompare.</li>
580 <div class="section" id="b1-2015-09-18">
581 <h1>3.5.0b1 (2015-09-18)</h1>
582 <div class="section" id="id81">
583 <h2>Features added</h2>
585 <li><tt class="docutils literal">cleanup_namespaces()</tt> accepts a new argument <tt class="docutils literal">keep_ns_prefixes</tt>
586 that does not remove definitions of the provided prefix-namespace
587 mapping from the tree.</li>
588 <li><tt class="docutils literal">cleanup_namespaces()</tt> accepts a new argument <tt class="docutils literal">top_nsmap</tt> that
589 moves definitions of the provided prefix-namespace mapping to the
590 top of the tree.</li>
591 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1490451">LP#1490451</a>: <tt class="docutils literal">Element</tt> objects gained a <tt class="docutils literal">cssselect()</tt> method as
592 known from <tt class="docutils literal">lxml.html</tt>. Patch by Simon Sapin.</li>
593 <li>API functions and methods behave and look more like Python functions,
594 which allows introspection on them etc. One side effect to be aware of
595 is that the functions now bind as methods when assigned to a class
596 variable. A quick fix is to wrap them in <tt class="docutils literal">staticmethod()</tt> (as for
597 normal Python functions).</li>
598 <li>ISO-Schematron support gained an option <tt class="docutils literal">error_finder</tt> that allows
599 passing a filter function for picking validation errors from reports.</li>
600 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1243600">LP#1243600</a>: Elements in <tt class="docutils literal">lxml.html</tt> gained a <tt class="docutils literal">classes</tt> property
601 that provides a set-like interface to the <tt class="docutils literal">class</tt> attribute.
602 Original patch by masklinn.</li>
603 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1341964">LP#1341964</a>: The soupparser now handles DOCTYPE declarations, comments
604 and processing instructions outside of the root element.
605 Patch by Olli Pottonen.</li>
606 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1421512">LP#1421512</a>: The <tt class="docutils literal">docinfo</tt> of a tree was made editable to allow
607 setting and removing the public ID and system ID of the DOCTYPE.
608 Patch by Olli Pottonen.</li>
609 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1442427">LP#1442427</a>: More work-arounds for quirks and bugs in pypy and pypy3.</li>
610 <li><tt class="docutils literal">lxml.html.soupparser</tt> now uses BeautifulSoup version 4 instead
611 of version 3 if available.</li>
614 <div class="section" id="id82">
617 <li>Memory errors that occur during tree adaptations (e.g. moving subtrees
618 to foreign documents) could leave the tree in a crash prone state.</li>
619 <li>Calling <tt class="docutils literal">process_children()</tt> in an XSLT extension element without
620 an <tt class="docutils literal">output_parent</tt> argument failed with a <tt class="docutils literal">TypeError</tt>.
621 Fix by Jens Tröger.</li>
622 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/162">GH#162</a>: Image data in HTML <tt class="docutils literal">data</tt> URLs is considered safe and
623 no longer removed by <tt class="docutils literal">lxml.html.clean</tt> JavaScript cleaner.</li>
624 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/166">GH#166</a>: Static build could link libraries in wrong order.</li>
625 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/172">GH#172</a>: Rely a bit more on libxml2 for encoding detection rather than
626 rolling our own in some cases. Patch by Olli Pottonen.</li>
627 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/159">GH#159</a>: Validity checks for names and string content were tightened
628 to detect the use of illegal characters early. Patch by Olli Pottonen.</li>
629 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1421921">LP#1421921</a>: Comments/PIs before the DOCTYPE declaration were not
630 serialised. Patch by Olli Pottonen.</li>
631 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/659367">LP#659367</a>: Some HTML DOCTYPE declarations were not serialised.
632 Patch by Olli Pottonen.</li>
633 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1238503">LP#1238503</a>: lxml.doctestcompare is now consistent with stdlib's doctest
634 in how it uses <tt class="docutils literal">+</tt> and <tt class="docutils literal">-</tt> to refer to unexpected and missing output.</li>
635 <li>Empty prefixes are explicitly rejected when a namespace mapping is used
636 with ElementPath to avoid hiding bugs in user code.</li>
637 <li>Several problems with PyPy were fixed by switching to Cython 0.23.</li>
641 <div class="section" id="id83">
642 <h1>3.4.4 (2015-04-25)</h1>
643 <div class="section" id="id84">
646 <li>An ElementTree compatibility test added in lxml 3.4.3 that failed in
647 Python 3.4+ was removed again.</li>
651 <div class="section" id="id85">
652 <h1>3.4.3 (2015-04-15)</h1>
653 <div class="section" id="id86">
656 <li>Expression cache in ElementPath was ignored. Fix by Changaco.</li>
657 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1426868">LP#1426868</a>: Passing a default namespace and a prefixed namespace mapping
658 as nsmap into <tt class="docutils literal">xmlfile.element()</tt> raised a <tt class="docutils literal">TypeError</tt>.</li>
659 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1421927">LP#1421927</a>: DOCTYPE system URLs were incorrectly quoted when containing
660 double quotes. Patch by Olli Pottonen.</li>
661 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1419354">LP#1419354</a>: meta-redirect URLs were incorrectly processed by
662 <tt class="docutils literal">iterlinks()</tt> if preceded by whitespace.</li>
666 <div class="section" id="id87">
667 <h1>3.4.2 (2015-02-07)</h1>
668 <div class="section" id="id88">
671 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1415907">LP#1415907</a>: Crash when creating an XMLSchema from a non-root element
672 of an XML document.</li>
673 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1369362">LP#1369362</a>: HTML cleaning failed when hitting processing instructions
674 with pseudo-attributes.</li>
675 <li><tt class="docutils literal">CDATA()</tt> wrapped content was rejected for tail text.</li>
676 <li>CDATA sections were not serialised as tail text of the top-level element.</li>
680 <div class="section" id="id89">
681 <h1>3.4.1 (2014-11-20)</h1>
682 <div class="section" id="id90">
683 <h2>Features added</h2>
685 <li>New <tt class="docutils literal">htmlfile</tt> HTML generator to accompany the incremental <tt class="docutils literal">xmlfile</tt>
686 serialisation API. Patch by Burak Arslan.</li>
689 <div class="section" id="id91">
692 <li><tt class="docutils literal">lxml.sax.ElementTreeContentHandler</tt> did not initialise its superclass.</li>
696 <div class="section" id="id92">
697 <h1>3.4.0 (2014-09-10)</h1>
698 <div class="section" id="id93">
699 <h2>Features added</h2>
701 <li><tt class="docutils literal">xmlfile(buffered=False)</tt> disables output buffering and flushes the
702 content after each API operation (starting/ending element blocks or writes).
703 A new method <tt class="docutils literal">xf.flush()</tt> can alternatively be used to explicitly flush
705 <li><tt class="docutils literal">lxml.html.document_fromstring</tt> has a new option <tt class="docutils literal">ensure_head_body=True</tt>
706 which will add an empty head and/or body element to the result document if
708 <li><tt class="docutils literal">lxml.html.iterlinks</tt> now returns links inside meta refresh tags.</li>
709 <li>New <tt class="docutils literal">XMLParser</tt> option <tt class="docutils literal">collect_ids=False</tt> to disable ID hash table
710 creation. This can substantially speed up parsing of documents with many
711 different IDs that are not used.</li>
712 <li>The parser uses per-document hash tables for XML IDs. This reduces the
713 load of the global parser dict and speeds up parsing for documents with
714 many different IDs.</li>
715 <li><tt class="docutils literal">ElementTree.getelementpath(element)</tt> returns a structural ElementPath
716 expression for the given element, which can be used for lookups later.</li>
717 <li><tt class="docutils literal">xmlfile()</tt> accepts a new argument <tt class="docutils literal">close=True</tt> to close file(-like)
718 objects after writing to them. Before, <tt class="docutils literal">xmlfile()</tt> only closed the file
719 if it had opened it internally.</li>
720 <li>Allow "bytearray" type for ASCII text input.</li>
723 <div class="section" id="id94">
726 <div class="section" id="id95">
727 <h2>Other changes</h2>
729 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/400588">LP#400588</a>: decoding errors have become hard errors even in recovery mode.
730 Previously, they could lead to an internal tree representation in a mixed
731 encoding state, which lead to very late errors or even silently incorrect
732 behaviour during tree traversal or serialisation.</li>
733 <li>Requires Python 2.6, 2.7, 3.2 or later. No longer supports
734 Python 2.4, 2.5 and 3.1, use lxml 3.3.x for those.</li>
735 <li>Requires libxml2 2.7.0 or later and libxslt 1.1.23 or later,
736 use lxml 3.3.x with older versions.</li>
740 <div class="section" id="id96">
741 <h1>3.3.6 (2014-08-28)</h1>
742 <div class="section" id="id97">
745 <li>Prevent tree cycle creation when adding Elements as siblings.</li>
746 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1361948">LP#1361948</a>: crash when deallocating Element siblings without parent.</li>
747 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1354652">LP#1354652</a>: crash when traversing internally loaded documents in XSLT
748 extension functions.</li>
752 <div class="section" id="id98">
753 <h1>3.3.5 (2014-04-18)</h1>
754 <div class="section" id="id99">
757 <li>HTML cleaning could fail to strip javascript links that mix control
758 characters into the link scheme.</li>
762 <div class="section" id="id100">
763 <h1>3.3.4 (2014-04-03)</h1>
764 <div class="section" id="id101">
765 <h2>Features added</h2>
767 <li>Source line numbers above 65535 are available on Elements when
768 using libxml2 2.9 or later.</li>
771 <div class="section" id="id102">
774 <li><tt class="docutils literal">lxml.html.fragment_fromstring()</tt> failed for bytes input in Py3.</li>
777 <div class="section" id="id103">
778 <h2>Other changes</h2>
781 <div class="section" id="id104">
782 <h1>3.3.3 (2014-03-04)</h1>
783 <div class="section" id="id105">
786 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1287118">LP#1287118</a>: Crash when using Element subtypes with <tt class="docutils literal">__slots__</tt>.</li>
789 <div class="section" id="id106">
790 <h2>Other changes</h2>
792 <li>The internal classes <tt class="docutils literal">_LogEntry</tt> and <tt class="docutils literal">_Attrib</tt> can no longer be
793 subclassed from Python code.</li>
797 <div class="section" id="id107">
798 <h1>3.3.2 (2014-02-26)</h1>
799 <div class="section" id="id108">
802 <li>The properties <tt class="docutils literal">resolvers</tt> and <tt class="docutils literal">version</tt>, as well as the methods
803 <tt class="docutils literal">set_element_class_lookup()</tt> and <tt class="docutils literal">makeelement()</tt>, were lost from
804 <tt class="docutils literal">iterparse</tt> objects in 3.3.0.</li>
805 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1222132">LP#1222132</a>: instances of <tt class="docutils literal">XMLSchema</tt>, <tt class="docutils literal">Schematron</tt> and <tt class="docutils literal">RelaxNG</tt>
806 did not clear their local <tt class="docutils literal">error_log</tt> before running a validation.</li>
807 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1238500">LP#1238500</a>: lxml.doctestcompare mixed up "expected" and "actual" in
808 attribute values.</li>
809 <li>Some file I/O tests were failing in MS-Windows due to non-portable temp
810 file usage. Initial patch by Gabi Davar.</li>
811 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/910014">LP#910014</a>: duplicate IDs in a document were not reported by DTD validation.</li>
812 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1185332">LP#1185332</a>: <tt class="docutils literal"><span class="pre">tostring(method="html")</span></tt> did not use HTML serialisation
813 semantics for trailing tail text. Initial patch by Sylvain Viollon.</li>
814 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1281139">LP#1281139</a>: <tt class="docutils literal">.attrib</tt> value of Comments lost its mutation methods
815 in 3.3.0. Even though it is empty and immutable, it should still
816 provide the same interface as that returned for Elements.</li>
820 <div class="section" id="id109">
821 <h1>3.3.1 (2014-02-12)</h1>
822 <div class="section" id="id110">
823 <h2>Features added</h2>
825 <div class="section" id="id111">
828 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1014290">LP#1014290</a>: HTML documents parsed with <tt class="docutils literal">parser.feed()</tt> failed to find
829 elements during tag iteration.</li>
830 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1273709">LP#1273709</a>: Building in PyPy failed due to missing support for
831 <tt class="docutils literal">PyUnicode_Compare()</tt> and <tt class="docutils literal"><span class="pre">PyByteArray_*()</span></tt> in PyPy's C-API.</li>
832 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1274413">LP#1274413</a>: Compilation in MSVC failed due to missing "stdint.h" standard
834 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1274118">LP#1274118</a>: iterparse() failed to parse BOM prefixed files.</li>
837 <div class="section" id="id112">
838 <h2>Other changes</h2>
841 <div class="section" id="id113">
842 <h1>3.3.0 (2014-01-26)</h1>
843 <div class="section" id="id114">
844 <h2>Features added</h2>
846 <div class="section" id="id115">
849 <li>The heuristic that distinguishes file paths from URLs was tightened
850 to produce less false negatives.</li>
853 <div class="section" id="id116">
854 <h2>Other changes</h2>
857 <div class="section" id="beta5-2014-01-18">
858 <h1>3.3.0beta5 (2014-01-18)</h1>
859 <div class="section" id="id117">
860 <h2>Features added</h2>
862 <li>The PEP 393 unicode parsing support gained a fallback for wchar strings
863 which might still be somewhat common on Windows systems.</li>
866 <div class="section" id="id118">
869 <li>Several error handling problems were fixed throughout the code base that
870 could previously lead to exceptions being silently swallowed or not
871 properly reported.</li>
872 <li>The C-API function <tt class="docutils literal">appendChild()</tt> is now deprecated as it does not
873 propagate exceptions (its return type is <tt class="docutils literal">void</tt>). The new function
874 <tt class="docutils literal">appendChildToElement()</tt> was added as a safe replacement.</li>
875 <li>Passing a string into <tt class="docutils literal">fromstringlist()</tt> raises an exception instead of
876 parsing the string character by character.</li>
879 <div class="section" id="id119">
880 <h2>Other changes</h2>
882 <li>Document cleanup code was simplified using the new GC features in
887 <div class="section" id="beta4-2014-01-12">
888 <h1>3.3.0beta4 (2014-01-12)</h1>
889 <div class="section" id="id120">
890 <h2>Features added</h2>
892 <div class="section" id="id121">
895 <li>The (empty) value returned by the <tt class="docutils literal">attrib</tt> property of Entity and Comment
896 objects was mutable.</li>
897 <li>Element class lookup wasn't available for the new pull parsers or when using
898 a custom parser target.</li>
899 <li>Setting Element attributes on instantiation with both the <tt class="docutils literal">attrib</tt> argument
900 and keyword arguments could modify the mapping passed as <tt class="docutils literal">attrib</tt>.</li>
901 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1266171">LP#1266171</a>: DTDs instantiated from internal/external subsets (i.e. through
902 the docinfo property) lost their attribute declarations.</li>
905 <div class="section" id="id122">
906 <h2>Other changes</h2>
908 <li>Built with Cython 0.20pre (gitrev 012ae82eb) to prepare support for
913 <div class="section" id="beta3-2014-01-02">
914 <h1>3.3.0beta3 (2014-01-02)</h1>
915 <div class="section" id="id123">
916 <h2>Features added</h2>
918 <li>Unicode string parsing was optimised for Python 3.3 (PEP 393).</li>
921 <div class="section" id="id124">
924 <li>HTML parsing of Unicode strings could misdecode the input on some platforms.</li>
925 <li>Crash in xmlfile() when closing open elements out of order in an error case.</li>
928 <div class="section" id="id125">
929 <h2>Other changes</h2>
932 <div class="section" id="beta2-2013-12-20">
933 <h1>3.3.0beta2 (2013-12-20)</h1>
934 <div class="section" id="id126">
935 <h2>Features added</h2>
937 <li><tt class="docutils literal">iterparse()</tt> supports the <tt class="docutils literal">recover</tt> option.</li>
940 <div class="section" id="id127">
943 <li>Crash in <tt class="docutils literal">iterparse()</tt> for HTML parsing.</li>
944 <li>Crash in target parsing with attributes.</li>
947 <div class="section" id="id128">
948 <h2>Other changes</h2>
950 <li>The safety check in the read-only tree implementation (e.g. used by
951 <tt class="docutils literal">PythonElementClassLookup</tt>) raises a more appropriate <tt class="docutils literal">ReferenceError</tt>
952 for illegal access after tree disposal instead of an <tt class="docutils literal">AssertionError</tt>.
953 This should only impact test code that specifically checks the original
958 <div class="section" id="beta1-2013-12-12">
959 <h1>3.3.0beta1 (2013-12-12)</h1>
960 <div class="section" id="id129">
961 <h2>Features added</h2>
963 <li>New option <tt class="docutils literal">handle_failures</tt> in <tt class="docutils literal">make_links_absolute()</tt> and
964 <tt class="docutils literal">resolve_base_href()</tt> (lxml.html) that enables ignoring or
965 discarding links that fail to parse as URLs.</li>
966 <li>New parser classes <tt class="docutils literal">XMLPullParser</tt> and <tt class="docutils literal">HTMLPullParser</tt> for
967 incremental parsing, as implemented for ElementTree in Python 3.4.</li>
968 <li><tt class="docutils literal">iterparse()</tt> enables recovery mode by default for HTML parsing
969 (<tt class="docutils literal">html=True</tt>).</li>
972 <div class="section" id="id130">
975 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1255132">LP#1255132</a>: crash when trying to run validation over non-Element (e.g.
977 <li>Error messages in the log and in exception messages that originated
978 from libxml2 could accidentally be picked up from preceding warnings
979 instead of the actual error.</li>
980 <li>The <tt class="docutils literal">ElementMaker</tt> in lxml.objectify did not accept a dict as
981 argument for adding attributes to the element it's building. This
982 works as in lxml.builder now.</li>
983 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1228881">LP#1228881</a>: <tt class="docutils literal">repr(XSLTAccessControl)</tt> failed in Python 3.</li>
984 <li>Raise <tt class="docutils literal">ValueError</tt> when trying to append an Element to itself or
985 to one of its own descendants, instead of running into an infinite
987 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1206077">LP#1206077</a>: htmldiff discarded whitespace from the output.</li>
988 <li>Compressed plain-text serialisation to file-like objects was broken.</li>
989 <li>lxml.html.formfill: Fix textarea form filling.
990 The textarea used to be cleared before the new content was set,
991 which removed the name attribute.</li>
994 <div class="section" id="id131">
995 <h2>Other changes</h2>
997 <li>Some basic API classes use freelists internally for faster
998 instantiation. This can speed up some <tt class="docutils literal">iterparse()</tt> scenarios,
1000 <li><tt class="docutils literal">iterparse()</tt> was rewritten to use the new <tt class="docutils literal">*PullParser</tt>
1001 classes internally instead of being a parser itself.</li>
1005 <div class="section" id="id132">
1006 <h1>3.2.5 (2014-01-02)</h1>
1007 <div class="section" id="id133">
1008 <h2>Features added</h2>
1010 <div class="section" id="id134">
1013 <li>Crash in xmlfile() when closing open elements out of order in an error case.</li>
1014 <li>Crash in target parsing with attributes.</li>
1015 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1255132">LP#1255132</a>: crash when trying to run validation over non-Element (e.g.
1016 comment or PI).</li>
1019 <div class="section" id="id136">
1020 <h2>Other changes</h2>
1023 <div class="section" id="id137">
1024 <h1>3.2.4 (2013-11-07)</h1>
1025 <div class="section" id="id138">
1026 <h2>Features added</h2>
1028 <div class="section" id="id139">
1031 <li>Memory leak when creating an XPath evaluator in a thread.</li>
1032 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1228881">LP#1228881</a>: <tt class="docutils literal">repr(XSLTAccessControl)</tt> failed in Python 3.</li>
1033 <li>Raise <tt class="docutils literal">ValueError</tt> when trying to append an Element to itself or
1034 to one of its own descendants.</li>
1035 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1206077">LP#1206077</a>: htmldiff discarded whitespace from the output.</li>
1036 <li>Compressed plain-text serialisation to file-like objects was broken.</li>
1039 <div class="section" id="id142">
1040 <h2>Other changes</h2>
1043 <div class="section" id="id143">
1044 <h1>3.2.3 (2013-07-28)</h1>
1045 <div class="section" id="id144">
1048 <li>Fix support for Python 2.4 which was lost in 3.2.2.</li>
1052 <div class="section" id="id145">
1053 <h1>3.2.2 (2013-07-28)</h1>
1054 <div class="section" id="id146">
1055 <h2>Features added</h2>
1057 <div class="section" id="id147">
1060 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1185701">LP#1185701</a>: spurious XMLSyntaxError after finishing iterparse().</li>
1061 <li>Crash in lxml.objectify during xsi annotation.</li>
1064 <div class="section" id="id148">
1065 <h2>Other changes</h2>
1067 <li>Return values of user provided element class lookup methods are now
1068 validated against the type of the XML node they represent to prevent
1069 API class mismatches.</li>
1073 <div class="section" id="id149">
1074 <h1>3.2.1 (2013-05-11)</h1>
1075 <div class="section" id="id150">
1076 <h2>Features added</h2>
1078 <li>The methods <tt class="docutils literal">apply_templates()</tt> and <tt class="docutils literal">process_children()</tt> of XSLT
1079 extension elements have gained two new boolean options <tt class="docutils literal">elements_only</tt>
1080 and <tt class="docutils literal">remove_blank_text</tt> that discard either all strings or whitespace-only
1081 strings from the result list.</li>
1084 <div class="section" id="id151">
1087 <li>When moving Elements to another tree, the namespace cleanup mechanism
1088 no longer drops namespace prefixes from attributes for which it finds
1089 a default namespace declaration, to prevent them from appearing as
1090 unnamespaced attributes after serialisation.</li>
1091 <li>Returning non-type objects from a custom class lookup method could lead
1093 <li>Instantiating and using subtypes of Comments and ProcessingInstructions
1097 <div class="section" id="id152">
1098 <h2>Other changes</h2>
1101 <div class="section" id="id153">
1102 <h1>3.2.0 (2013-04-28)</h1>
1103 <div class="section" id="id154">
1104 <h2>Features added</h2>
1106 <div class="section" id="id155">
1109 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/690319">LP#690319</a>: Leading whitespace could change the behaviour of the string
1110 parsing functions in <tt class="docutils literal">lxml.html</tt>.</li>
1111 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/599318">LP#599318</a>: The string parsing functions in <tt class="docutils literal">lxml.html</tt> are more robust
1112 in the face of uncommon HTML content like framesets or missing body tags.
1113 Patch by Stefan Seelmann.</li>
1114 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/712941">LP#712941</a>: I/O errors while trying to access files with paths that contain
1115 non-ASCII characters could raise <tt class="docutils literal">UnicodeDecodeError</tt> instead of properly
1116 reporting the <tt class="docutils literal">IOError</tt>.</li>
1117 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/673205">LP#673205</a>: Parsing from in-memory strings disabled network access in the
1118 default parser and made subsequent attempts to parse from a URL fail.</li>
1119 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/971754">LP#971754</a>: lxml.html.clean appends 'nofollow' to 'rel' attributes instead
1120 of overwriting the current value.</li>
1121 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/715687">LP#715687</a>: lxml.html.clean no longer discards scripts that are explicitly
1122 allowed by the user provided whitelist. Patch by Christine Koppelt.</li>
1125 <div class="section" id="id156">
1126 <h2>Other changes</h2>
1129 <div class="section" id="id157">
1130 <h1>3.1.2 (2013-04-12)</h1>
1131 <div class="section" id="id158">
1132 <h2>Features added</h2>
1134 <div class="section" id="id159">
1137 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1136509">LP#1136509</a>: Passing attributes through the namespace-unaware API of
1138 the sax bridge (i.e. the <tt class="docutils literal">handler.startElement()</tt> method) failed
1139 with a <tt class="docutils literal">TypeError</tt>. Patch by Mike Bayer.</li>
1140 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1123074">LP#1123074</a>: Fix serialisation error in XSLT output when converting
1141 the result tree to a Unicode string.</li>
1142 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/105">GH#105</a>: Replace illegal usage of <tt class="docutils literal">xmlBufLength()</tt> in libxml2 2.9.0
1143 by properly exported API function <tt class="docutils literal">xmlBufUse()</tt>.</li>
1146 <div class="section" id="id160">
1147 <h2>Other changes</h2>
1150 <div class="section" id="id161">
1151 <h1>3.1.1 (2013-03-29)</h1>
1152 <div class="section" id="id162">
1153 <h2>Features added</h2>
1155 <div class="section" id="id163">
1158 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1160386">LP#1160386</a>: Write access to <tt class="docutils literal">lxml.html.FormElement.fields</tt> raised
1159 an AttributeError in Py3.</li>
1160 <li>Illegal memory access during cleanup in incremental xmlfile writer.</li>
1163 <div class="section" id="id164">
1164 <h2>Other changes</h2>
1166 <li>The externally useless class <tt class="docutils literal">lxml.etree._BaseParser</tt> was removed
1167 from the module dict.</li>
1171 <div class="section" id="id165">
1172 <h1>3.1.0 (2013-02-10)</h1>
1173 <div class="section" id="id166">
1174 <h2>Features added</h2>
1176 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/89">GH#89</a>: lxml.html.clean allows overriding the set of attributes that it
1177 considers 'safe'. Patch by Francis Devereux.</li>
1180 <div class="section" id="id167">
1183 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1104370">LP#1104370</a>: <tt class="docutils literal">copy.copy(el.attrib)</tt> raised an exception. It now returns
1184 a copy of the attributes as a plain Python dict.</li>
1185 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/95">GH#95</a>: When used with namespace prefixes, the <tt class="docutils literal"><span class="pre">el.find*()</span></tt> methods
1186 always used the first namespace mapping that was provided for each
1187 path expression instead of using the one that was actually passed
1188 in for the current run.</li>
1189 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1092521">LP#1092521</a>, <a class="reference external" href="https://github.com/lxml/lxml/issues/91">GH#91</a>: Fix undefined C symbol in Python runtimes compiled
1190 without threading support. Patch by Ulrich Seidl.</li>
1193 <div class="section" id="id168">
1194 <h2>Other changes</h2>
1197 <div class="section" id="beta1-2012-12-21">
1198 <h1>3.1beta1 (2012-12-21)</h1>
1199 <div class="section" id="id169">
1200 <h2>Features added</h2>
1202 <li>New build-time option <tt class="docutils literal"><span class="pre">--with-unicode-strings</span></tt> for Python 2 that
1203 makes the API always return Unicode strings for names and text
1204 instead of byte strings for plain ASCII content.</li>
1205 <li>New incremental XML file writing API <tt class="docutils literal">etree.xmlfile()</tt>.</li>
1206 <li>E factory in lxml.objectify is callable to simplify the creation of
1207 tags with non-identifier names without having to resort to getattr().</li>
1210 <div class="section" id="id170">
1213 <li>When starting from a non-namespaced element in lxml.objectify, searching
1214 for a child without explicitly specifying a namespace incorrectly found
1215 namespaced elements with the requested local name, instead of restricting
1216 the search to non-namespaced children.</li>
1217 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/85">GH#85</a>: Deprecation warnings were fixed for Python 3.x.</li>
1218 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/33">GH#33</a>: lxml.html.fromstring() failed to accept bytes input in Py3.</li>
1219 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1080792">LP#1080792</a>: Static build of libxml2 2.9.0 failed due to missing file.</li>
1222 <div class="section" id="id171">
1223 <h2>Other changes</h2>
1225 <li>The externally useless class <tt class="docutils literal">_ObjectifyElementMakerCaller</tt> was
1226 removed from the module API of lxml.objectify.</li>
1227 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1075622">LP#1075622</a>: lxml.builder is faster for adding text to elements with
1228 many children. Patch by Anders Hammarquist.</li>
1232 <div class="section" id="id172">
1233 <h1>3.0.2 (2012-12-14)</h1>
1234 <div class="section" id="id173">
1235 <h2>Features added</h2>
1237 <div class="section" id="id174">
1240 <li>Fix crash during interpreter shutdown by switching to Cython 0.17.3 for building.</li>
1243 <div class="section" id="id175">
1244 <h2>Other changes</h2>
1247 <div class="section" id="id176">
1248 <h1>3.0.1 (2012-10-14)</h1>
1249 <div class="section" id="id177">
1250 <h2>Features added</h2>
1252 <div class="section" id="id178">
1255 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1065924">LP#1065924</a>: Element proxies could disappear during garbage collection
1256 in PyPy without proper cleanup.</li>
1257 <li><a class="reference external" href="https://github.com/lxml/lxml/issues/71">GH#71</a>: Failure to work with libxml2 2.6.x.</li>
1258 <li><a class="reference external" href="https://bugs.launchpad.net/lxml/+bug/1065139">LP#1065139</a>: static MacOS-X build failed in Py3.</li>
1261 <div class="section" id="id179">
1262 <h2>Other changes</h2>
1265 <div class="section" id="id180">
1266 <h1>3.0 (2012-10-08)</h1>
1267 <div class="section" id="id181">
1268 <h2>Features added</h2>
1270 <div class="section" id="id182">
1273 <li>End-of-file handling was incorrect in iterparse() when reading from
1274 a low-level C file stream and failed in libxml2 2.9.0 due to its
1275 improved consistency checks.</li>
1278 <div class="section" id="id183">
1279 <h2>Other changes</h2>
1281 <li>The build no longer uses Cython by default unless the generated C files
1282 are missing. To use Cython, pass the option "--with-cython". To ignore
1283 the fatal build error when Cython is required but not available (e.g. to
1284 run special setup.py commands that do not actually run a build), pass
1285 "--without-cython".</li>
1289 <div class="section" id="beta1-2012-09-26">
1290 <h1>3.0beta1 (2012-09-26)</h1>
1291 <div class="section" id="id184">
1292 <h2>Features added</h2>
1294 <li>Python level access to (optional) libxml2 memory debugging features
1295 to simplify debugging of memory leaks etc.</li>
1298 <div class="section" id="id185">
1301 <li>Fix a memory leak in XPath by switching to Cython 0.17.1.</li>
1302 <li>Some tests were adapted to work with PyPy.</li>
1305 <div class="section" id="id186">
1306 <h2>Other changes</h2>
1308 <li>The code was adapted to work with the upcoming libxml2 2.9.0 release.</li>
1312 <div class="section" id="alpha2-2012-08-23">
1313 <h1>3.0alpha2 (2012-08-23)</h1>
1314 <div class="section" id="id187">
1315 <h2>Features added</h2>
1317 <li>The <tt class="docutils literal">.iter()</tt> method of elements now accepts <tt class="docutils literal">tag</tt> arguments like
1318 <tt class="docutils literal"><span class="pre">"{*}name"</span></tt> to search for elements with a given local name in any
1319 namespace. With this addition, all combinations of wildcards now work
1321 <tt class="docutils literal">"{ns}name"</tt>, <tt class="docutils literal"><span class="pre">"{}name"</span></tt>, <tt class="docutils literal"><span class="pre">"{*}name"</span></tt>, <tt class="docutils literal"><span class="pre">"{ns}*"</span></tt>, <tt class="docutils literal"><span class="pre">"{}*"</span></tt>
1322 and <tt class="docutils literal"><span class="pre">"{*}*"</span></tt>. Note that <tt class="docutils literal">"name"</tt> is equivalent to <tt class="docutils literal"><span class="pre">"{}name"</span></tt>,
1323 but <tt class="docutils literal">"*"</tt> is <tt class="docutils literal"><span class="pre">"{*}*"</span></tt>.
1324 The same change applies to the <tt class="docutils literal">.getiterator()</tt>, <tt class="docutils literal">.itersiblings()</tt>,
1325 <tt class="docutils literal">.iterancestors()</tt>, <tt class="docutils literal">.iterdescendants()</tt>, <tt class="docutils literal">.iterchildren()</tt>
1326 and <tt class="docutils literal">.itertext()</tt> methods;the <tt class="docutils literal">strip_attributes()</tt>,
1327 <tt class="docutils literal">strip_elements()</tt> and <tt class="docutils literal">strip_tags()</tt> functions as well as the
1328 <tt class="docutils literal">iterparse()</tt> class. Patch by Simon Sapin.</li>
1329 <li>C14N allows specifying the inclusive prefixes to be promoted
1330 to top-level during exclusive serialisation.</li>
1333 <div class="section" id="id188">
1336 <li>Passing long Unicode strings into the <tt class="docutils literal">feed()</tt> parser interface
1337 failed to read the entire string.</li>
1340 <div class="section" id="id189">
1341 <h2>Other changes</h2>
1344 <div class="section" id="alpha1-2012-07-31">
1345 <h1>3.0alpha1 (2012-07-31)</h1>
1346 <div class="section" id="id190">
1347 <h2>Features added</h2>
1349 <li>Initial support for building in PyPy (through cpyext).</li>
1350 <li>DTD objects gained an API that allows read access to their
1352 <li><tt class="docutils literal">xpathgrep.py</tt> gained support for parsing line-by-line (e.g.
1353 from grep output) and for surrounding the output with a new root
1355 <li><tt class="docutils literal"><span class="pre">E-factory</span></tt> in <tt class="docutils literal">lxml.builder</tt> accepts subtypes of known data
1356 types (such as string subtypes) when building elements around them.</li>
1357 <li>Tree iteration and <tt class="docutils literal">iterparse()</tt> with a selective <tt class="docutils literal">tag</tt>
1358 argument supports passing a set of tags. Tree nodes will be
1359 returned by the iterators if they match any of the tags.</li>
1362 <div class="section" id="id191">
1365 <li>The <tt class="docutils literal"><span class="pre">.find*()</span></tt> methods in <tt class="docutils literal">lxml.objectify</tt> no longer use XPath
1366 internally, which makes them faster in many cases (especially when
1367 short circuiting after a single or couple of elements) and fixes
1368 some behavioural differences compared to <tt class="docutils literal">lxml.etree</tt>. Note that
1369 this means that they no longer support arbitrary XPath expressions
1370 but only the subset that the <tt class="docutils literal">ElementPath</tt> language supports.
1371 The previous implementation was also redundant with the normal
1372 XPath support, which can be used as a replacement.</li>
1373 <li><tt class="docutils literal"><span class="pre">el.find('*')</span></tt> could accidentally return a comment or processing
1374 instruction that happened to be in the wrong spot. (Same for the
1375 other <tt class="docutils literal"><span class="pre">.find*()</span></tt> methods.)</li>
1376 <li>The error logging is less intrusive and avoids a global setup where
1378 <li>Fixed undefined names in html5lib parser.</li>
1379 <li><tt class="docutils literal">xpathgrep.py</tt> did not work in Python 3.</li>
1380 <li><tt class="docutils literal">Element.attrib.update()</tt> did not accept an <tt class="docutils literal">attrib</tt> of
1381 another Element as parameter.</li>
1382 <li>For subtypes of <tt class="docutils literal">ElementBase</tt> that make the <tt class="docutils literal">.text</tt> or <tt class="docutils literal">.tail</tt>
1383 properties immutable (as in objectify, for example), inserting text
1384 when creating Elements through the E-Factory feature of the class
1385 constructor would fail with an exception, stating that the text
1386 cannot be modified.</li>
1389 <div class="section" id="id192">
1390 <h2>Other changes</h2>
1392 <li>The code base was overhauled to properly use 'const' where the API
1393 of libxml2 and libxslt requests it. This also has an impact on the
1394 public C-API of lxml itself, as defined in <tt class="docutils literal">etreepublic.pxd</tt>, as
1395 well as the provided declarations in the <tt class="docutils literal">lxml/includes/</tt> directory.
1396 Code that uses these declarations may have to be adapted. On the
1397 plus side, this fixes several C compiler warnings, also for user
1398 code, thus making it easier to spot real problems again.</li>
1399 <li>The functionality of "lxml.cssselect" was moved into a separate PyPI
1400 package called "cssselect". To continue using it, you must install
1401 that package separately. The "lxml.cssselect" module is still
1402 available and provides the same interface, provided the "cssselect"
1403 package can be imported at runtime.</li>
1404 <li>Element attributes passed in as an <tt class="docutils literal">attrib</tt> dict or as keyword
1405 arguments are now sorted by (namespaced) name before being created
1406 to make their order predictable for serialisation and iteration.
1407 Note that adding or deleting attributes afterwards does not take
1408 that order into account, i.e. setting a new attribute appends it
1409 after the existing ones.</li>
1410 <li>Several classes that are for internal use only were removed
1411 from the <tt class="docutils literal">lxml.etree</tt> module dict:
1412 <tt class="docutils literal">_InputDocument, _ResolverRegistry, _ResolverContext, _BaseContext,
1413 _ExsltRegExp, _IterparseContext, _TempStore, _ExceptionContext,
1414 __ContentOnlyElement, _AttribIterator, _NamespaceRegistry,
1415 _ClassNamespaceRegistry, _FunctionNamespaceRegistry,
1416 _XPathFunctionNamespaceRegistry, _ParserDictionaryContext,
1417 _FileReaderContext, _ParserContext, _PythonSaxParserTarget,
1418 _TargetParserContext, _ReadOnlyProxy, _ReadOnlyPIProxy,
1419 _ReadOnlyEntityProxy, _ReadOnlyElementProxy, _OpaqueNodeWrapper,
1420 _OpaqueDocumentWrapper, _ModifyContentOnlyProxy,
1421 _ModifyContentOnlyPIProxy, _ModifyContentOnlyEntityProxy,
1422 _AppendOnlyElementProxy, _SaxParserContext, _FilelikeWriter,
1423 _ParserSchemaValidationContext, _XPathContext,
1424 _XSLTResolverContext, _XSLTContext, _XSLTQuotedStringParam</tt></li>
1425 <li>Several internal classes can no longer be inherited from:
1426 <tt class="docutils literal">_InputDocument, _ResolverRegistry, _ExsltRegExp, _ElementUnicodeResult,
1427 _IterparseContext, _TempStore, _AttribIterator, _ClassNamespaceRegistry,
1428 _XPathFunctionNamespaceRegistry, _ParserDictionaryContext,
1429 _FileReaderContext, _PythonSaxParserTarget, _TargetParserContext,
1430 _ReadOnlyPIProxy, _ReadOnlyEntityProxy, _OpaqueDocumentWrapper,
1431 _ModifyContentOnlyPIProxy, _ModifyContentOnlyEntityProxy,
1432 _AppendOnlyElementProxy, _FilelikeWriter, _ParserSchemaValidationContext,
1433 _XPathContext, _XSLTResolverContext, _XSLTContext, _XSLTQuotedStringParam,
1434 _XSLTResultTree, _XSLTProcessingInstruction</tt></li>
1438 <div class="section" id="id193">
1439 <h1>2.3.6 (2012-09-28)</h1>
1440 <div class="section" id="id194">
1441 <h2>Features added</h2>
1443 <div class="section" id="id195">
1446 <li>Passing long Unicode strings into the <tt class="docutils literal">feed()</tt> parser interface
1447 failed to read the entire string.</li>
1450 <div class="section" id="id196">
1451 <h2>Other changes</h2>
1454 <div class="section" id="id197">
1455 <h1>2.3.5 (2012-07-31)</h1>
1456 <div class="section" id="id198">
1457 <h2>Features added</h2>
1459 <div class="section" id="id199">
1462 <li>Crash when merging text nodes in <tt class="docutils literal">element.remove()</tt>.</li>
1463 <li>Crash in sax/target parser when reporting empty doctype.</li>
1466 <div class="section" id="id200">
1467 <h2>Other changes</h2>
1470 <div class="section" id="id201">
1471 <h1>2.3.4 (2012-03-26)</h1>
1472 <div class="section" id="id202">
1473 <h2>Features added</h2>
1475 <div class="section" id="id203">
1478 <li>Crash when building an nsmap (Element property) with empty
1479 namespace URIs.</li>
1480 <li>Crash due to race condition when errors (or user messages) occur
1481 during threaded XSLT processing.</li>
1482 <li>XSLT stylesheet compilation could ignore compilation errors.</li>
1485 <div class="section" id="id204">
1486 <h2>Other changes</h2>
1489 <div class="section" id="id205">
1490 <h1>2.3.3 (2012-01-04)</h1>
1491 <div class="section" id="id206">
1492 <h2>Features added</h2>
1494 <li><tt class="docutils literal">lxml.html.tostring()</tt> gained new serialisation options
1495 <tt class="docutils literal">with_tail</tt> and <tt class="docutils literal">doctype</tt>.</li>
1498 <div class="section" id="id207">
1501 <li>Fixed a crash when using <tt class="docutils literal">iterparse()</tt> for HTML parsing and
1502 requesting start events.</li>
1503 <li>Fixed parsing of more selectors in cssselect. Whitespace before
1504 pseudo-elements and pseudo-classes is significant as it is a
1505 descendant combinator.
1506 "E :pseudo" should parse the same as "E *:pseudo", not "E:pseudo".
1507 Patch by Simon Sapin.</li>
1508 <li>lxml.html.diff no longer raises an exception when hitting
1509 'img' tags without 'src' attribute.</li>
1512 <div class="section" id="id208">
1513 <h2>Other changes</h2>
1516 <div class="section" id="id209">
1517 <h1>2.3.2 (2011-11-11)</h1>
1518 <div class="section" id="id210">
1519 <h2>Features added</h2>
1521 <li><tt class="docutils literal">lxml.objectify.deannotate()</tt> has a new boolean option
1522 <tt class="docutils literal">cleanup_namespaces</tt> to remove the objectify namespace
1523 declarations (and generally clean up the namespace declarations)
1524 after removing the type annotations.</li>
1525 <li><tt class="docutils literal">lxml.objectify</tt> gained its own <tt class="docutils literal">SubElement()</tt> function as a
1526 copy of <tt class="docutils literal">etree.SubElement</tt> to avoid an otherwise redundant import
1527 of <tt class="docutils literal">lxml.etree</tt> on the user side.</li>
1530 <div class="section" id="id211">
1533 <li>Fixed the "descendant" bug in cssselect a second time (after a first
1534 fix in lxml 2.3.1). The previous change resulted in a serious
1535 performance regression for the XPath based evaluation of the
1536 translated expression. Note that this breaks the usage of some of
1537 the generated XPath expressions as XSLT location paths that
1538 previously worked in 2.3.1.</li>
1539 <li>Fixed parsing of some selectors in cssselect. Whitespace after combinators
1540 ">", "+" and "~" is now correctly ignored. Previously it was parsed as
1541 a descendant combinator. For example, "div> .foo" was parsed the same as
1542 "div>* .foo" instead of "div>.foo". Patch by Simon Sapin.</li>
1545 <div class="section" id="id212">
1546 <h2>Other changes</h2>
1549 <div class="section" id="id213">
1550 <h1>2.3.1 (2011-09-25)</h1>
1551 <div class="section" id="id214">
1552 <h2>Features added</h2>
1554 <li>New option <tt class="docutils literal">kill_tags</tt> in <tt class="docutils literal">lxml.html.clean</tt> to remove specific
1555 tags and their content (i.e. their whole subtree).</li>
1556 <li><tt class="docutils literal">pi.get()</tt> and <tt class="docutils literal">pi.attrib</tt> on processing instructions to parse
1557 pseudo-attributes from the text content of processing instructions.</li>
1558 <li><tt class="docutils literal">lxml.get_include()</tt> returns a list of include paths that can be
1559 used to compile external C code against lxml.etree. This is
1560 specifically required for statically linked lxml builds when code
1561 needs to compile against the exact same header file versions as lxml
1563 <li><tt class="docutils literal">Resolver.resolve_file()</tt> takes an additional option
1564 <tt class="docutils literal">close_file</tt> that configures if the file(-like) object will be
1565 closed after reading or not. By default, the file will be closed,
1566 as the user is not expected to keep a reference to it.</li>
1569 <div class="section" id="id215">
1572 <li>HTML cleaning didn't remove 'data:' links.</li>
1573 <li>The html5lib parser integration now uses the 'official'
1574 implementation in html5lib itself, which makes it work with newer
1575 releases of the library.</li>
1576 <li>In <tt class="docutils literal">lxml.sax</tt>, <tt class="docutils literal">endElementNS()</tt> could incorrectly reject a plain
1577 tag name when the corresponding start event inferred the same plain
1578 tag name to be in the default namespace.</li>
1579 <li>When an open file-like object is passed into <tt class="docutils literal">parse()</tt> or
1580 <tt class="docutils literal">iterparse()</tt>, the parser will no longer close it after use. This
1581 reverts a change in lxml 2.3 where all files would be closed. It is
1582 the users responsibility to properly close the file(-like) object,
1583 also in error cases.</li>
1584 <li>Assertion error in lxml.html.cleaner when discarding top-level elements.</li>
1585 <li>In lxml.cssselect, use the xpath 'A//B' (short for
1586 'A/descendant-or-self::node()/B') instead of 'A/descendant::B' for
1587 the css descendant selector ('A B'). This makes a few edge cases
1588 like <tt class="docutils literal">"div <span class="pre">*:last-child"</span></tt> consistent with the selector behavior in
1589 WebKit and Firefox, and makes more css expressions valid location
1590 paths (for use in xsl:template match).</li>
1591 <li>In lxml.html, non-selected <tt class="docutils literal"><option></tt> tags no longer show up in the
1592 collected form values.</li>
1593 <li>Adding/removing <tt class="docutils literal"><option></tt> values to/from a multiple select form
1594 field properly selects them and unselects them.</li>
1597 <div class="section" id="id216">
1598 <h2>Other changes</h2>
1600 <li>Static builds can specify the download directory with the
1601 <tt class="docutils literal"><span class="pre">--download-dir</span></tt> option.</li>
1605 <div class="section" id="id217">
1606 <h1>2.3 (2011-02-06)</h1>
1607 <div class="section" id="id218">
1608 <h2>Features added</h2>
1610 <li>When looking for children, <tt class="docutils literal">lxml.objectify</tt> takes '{}tag' as
1611 meaning an empty namespace, as opposed to the parent namespace.</li>
1614 <div class="section" id="id219">
1617 <li>When finished reading from a file-like object, the parser
1618 immediately calls its <tt class="docutils literal">.close()</tt> method.</li>
1619 <li>When finished parsing, <tt class="docutils literal">iterparse()</tt> immediately closes the input
1621 <li>Work-around for libxml2 bug that can leave the HTML parser in a
1622 non-functional state after parsing a severely broken document (fixed
1623 in libxml2 2.7.8).</li>
1624 <li><tt class="docutils literal">marque</tt> tag in HTML cleanup code is correctly named <tt class="docutils literal">marquee</tt>.</li>
1627 <div class="section" id="id220">
1628 <h2>Other changes</h2>
1630 <li>Some public functions in the Cython-level C-API have more explicit
1635 <div class="section" id="beta1-2010-09-06">
1636 <h1>2.3beta1 (2010-09-06)</h1>
1637 <div class="section" id="id221">
1638 <h2>Features added</h2>
1640 <div class="section" id="id222">
1643 <li>Crash in newer libxml2 versions when moving elements between
1644 documents that had attributes on replaced XInclude nodes.</li>
1645 <li><tt class="docutils literal">XMLID()</tt> function was missing the optional <tt class="docutils literal">parser</tt> and
1646 <tt class="docutils literal">base_url</tt> parameters.</li>
1647 <li>Searching for wildcard tags in <tt class="docutils literal">iterparse()</tt> was broken in Py3.</li>
1648 <li><tt class="docutils literal">lxml.html.open_in_browser()</tt> didn't work in Python 3 due to the
1649 use of os.tempnam. It now takes an optional 'encoding' parameter.</li>
1652 <div class="section" id="id223">
1653 <h2>Other changes</h2>
1656 <div class="section" id="alpha2-2010-07-24">
1657 <h1>2.3alpha2 (2010-07-24)</h1>
1658 <div class="section" id="id224">
1659 <h2>Features added</h2>
1661 <div class="section" id="id225">
1664 <li>Crash in XSLT when generating text-only result documents with a
1665 stylesheet created in a different thread.</li>
1668 <div class="section" id="id226">
1669 <h2>Other changes</h2>
1671 <li><tt class="docutils literal">repr()</tt> of Element objects shows the hex ID with leading 0x
1672 (following ElementTree 1.3).</li>
1676 <div class="section" id="alpha1-2010-06-19">
1677 <h1>2.3alpha1 (2010-06-19)</h1>
1678 <div class="section" id="id227">
1679 <h2>Features added</h2>
1681 <li>Keyword argument <tt class="docutils literal">namespaces</tt> in <tt class="docutils literal">lxml.cssselect.CSSSelector()</tt>
1682 to pass a prefix-to-namespace mapping for the selector.</li>
1683 <li>New function <tt class="docutils literal">lxml.etree.register_namespace(prefix, uri)</tt> that
1684 globally registers a namespace prefix for a namespace that newly
1685 created Elements in that namespace will use automatically. Follows
1686 ElementTree 1.3.</li>
1687 <li>Support 'unicode' string name as encoding parameter in
1688 <tt class="docutils literal">tostring()</tt>, following ElementTree 1.3.</li>
1689 <li>Support 'c14n' serialisation method in <tt class="docutils literal">ElementTree.write()</tt> and
1690 <tt class="docutils literal">tostring()</tt>, following ElementTree 1.3.</li>
1691 <li>The ElementPath expression syntax (<tt class="docutils literal"><span class="pre">el.find*()</span></tt>) was extended to
1692 match the upcoming ElementTree 1.3 that will ship in the standard
1693 library of Python 3.2/2.7. This includes extended support for
1694 predicates as well as namespace prefixes (as known from XPath).</li>
1695 <li>During regular XPath evaluation, various ESXLT functions are
1696 available within their namespace when using libxslt 1.1.26 or later.</li>
1697 <li>Support passing a readily configured logger instance into
1698 <tt class="docutils literal">PyErrorLog</tt>, instead of a logger name.</li>
1699 <li>On serialisation, the new <tt class="docutils literal">doctype</tt> parameter can be used to
1700 override the DOCTYPE (internal subset) of the document.</li>
1701 <li>New parameter <tt class="docutils literal">output_parent</tt> to <tt class="docutils literal">XSLTExtension.apply_templates()</tt>
1702 to append the resulting content directly to an output element.</li>
1703 <li><tt class="docutils literal">XSLTExtension.process_children()</tt> to process the content of the
1704 XSLT extension element itself.</li>
1705 <li>ISO-Schematron support based on the de-facto Schematron reference
1706 'skeleton implementation'.</li>
1707 <li>XSLT objects now take XPath object as <tt class="docutils literal">__call__</tt> stylesheet
1709 <li>Enable path caching in ElementPath (<tt class="docutils literal"><span class="pre">el.find*()</span></tt>) to avoid parsing
1711 <li>Setting the value of a namespaced attribute always uses a prefixed
1712 namespace instead of the default namespace even if both declare the
1713 same namespace URI. This avoids serialisation problems when an
1714 attribute from a default namespace is set on an element from a
1715 different namespace.</li>
1716 <li>XSLT extension elements: support for XSLT context nodes other than
1717 elements: document root, comments, processing instructions.</li>
1718 <li>Support for strings (in addition to Elements) in node-sets returned
1719 by extension functions.</li>
1720 <li>Forms that lack an <tt class="docutils literal">action</tt> attribute default to the base URL of
1721 the document on submit.</li>
1722 <li>XPath attribute result strings have an <tt class="docutils literal">attrname</tt> property.</li>
1723 <li>Namespace URIs get validated against RFC 3986 at the API level
1724 (required by the XML namespace specification).</li>
1725 <li>Target parsers show their target object in the <tt class="docutils literal">.target</tt> property
1726 (compatible with ElementTree).</li>
1729 <div class="section" id="id228">
1732 <li>API is hardened against invalid proxy instances to prevent crashes
1733 due to incorrectly instantiated Element instances.</li>
1734 <li>Prevent crash when instantiating <tt class="docutils literal">CommentBase</tt> and friends.</li>
1735 <li>Export ElementTree compatible XML parser class as
1736 <tt class="docutils literal">XMLTreeBuilder</tt>, as it is called in ET 1.2.</li>
1737 <li>ObjectifiedDataElements in lxml.objectify were not hashable. They
1738 now use the hash value of the underlying Python value (string,
1739 number, etc.) to which they compare equal.</li>
1740 <li>Parsing broken fragments in lxml.html could fail if the fragment
1741 contained an orphaned closing '</div>' tag.</li>
1742 <li>Using XSLT extension elements around the root of the output document
1744 <li><tt class="docutils literal">lxml.cssselect</tt> did not distinguish between <tt class="docutils literal"><span class="pre">x[attr="val"]</span></tt> and
1745 <tt class="docutils literal">x <span class="pre">[attr="val"]</span></tt> (with a space). The latter now matches the
1746 attribute independent of the element.</li>
1747 <li>Rewriting multiple links inside of HTML text content could end up
1748 replacing unrelated content as replacements could impact the
1749 reported position of subsequent matches. Modifications are now
1750 simplified by letting the <tt class="docutils literal">iterlinks()</tt> generator in <tt class="docutils literal">lxml.html</tt>
1751 return links in reversed order if they appear inside the same text
1752 node. Thus, replacements and link-internal modifications no longer
1753 change the position of links reported afterwards.</li>
1754 <li>The <tt class="docutils literal">.value</tt> attribute of <tt class="docutils literal">textarea</tt> elements in lxml.html did
1755 not represent the complete raw value (including child tags etc.). It
1756 now serialises the complete content on read and replaces the
1757 complete content by a string on write.</li>
1758 <li>Target parser didn't call <tt class="docutils literal">.close()</tt> on the target object if
1759 parsing failed. Now it is guaranteed that <tt class="docutils literal">.close()</tt> will be
1760 called after parsing, regardless of the outcome.</li>
1763 <div class="section" id="id229">
1764 <h2>Other changes</h2>
1766 <li>Official support for Python 3.1.2 and later.</li>
1767 <li>Static MS Windows builds can now download their dependencies
1769 <li><tt class="docutils literal">Element.attrib</tt> no longer uses a cyclic reference back to its
1770 Element object. It therefore no longer requires the garbage
1771 collector to clean up.</li>
1772 <li>Static builds include libiconv, in addition to libxml2 and libxslt.</li>
1776 <div class="section" id="id230">
1777 <h1>2.2.8 (2010-09-02)</h1>
1778 <div class="section" id="id231">
1781 <li>Crash in newer libxml2 versions when moving elements between
1782 documents that had attributes on replaced XInclude nodes.</li>
1783 <li>Import fix for urljoin in Python 3.1+.</li>
1787 <div class="section" id="id232">
1788 <h1>2.2.7 (2010-07-24)</h1>
1789 <div class="section" id="id233">
1792 <li>Crash in XSLT when generating text-only result documents with a
1793 stylesheet created in a different thread.</li>
1797 <div class="section" id="id234">
1798 <h1>2.2.6 (2010-03-02)</h1>
1799 <div class="section" id="id235">
1802 <li>Fixed several Python 3 regressions by building with Cython 0.11.3.</li>
1806 <div class="section" id="id236">
1807 <h1>2.2.5 (2010-02-28)</h1>
1808 <div class="section" id="id237">
1809 <h2>Features added</h2>
1811 <li>Support for running XSLT extension elements on the input root node
1812 (e.g. in a template matching on "/").</li>
1815 <div class="section" id="id238">
1818 <li>Crash in XPath evaluation when reading smart strings from a document
1819 other than the original context document.</li>
1820 <li>Support recent versions of html5lib by not requiring its
1821 <tt class="docutils literal">XHTMLParser</tt> in <tt class="docutils literal">htmlparser.py</tt> anymore.</li>
1822 <li>Manually instantiating the custom element classes in
1823 <tt class="docutils literal">lxml.objectify</tt> could crash.</li>
1824 <li>Invalid XML text characters were not rejected by the API when they
1825 appeared in unicode strings directly after non-ASCII characters.</li>
1826 <li>lxml.html.open_http_urllib() did not work in Python 3.</li>
1827 <li>The functions <tt class="docutils literal">strip_tags()</tt> and <tt class="docutils literal">strip_elements()</tt> in
1828 <tt class="docutils literal">lxml.etree</tt> did not remove all occurrences of a tag in all cases.</li>
1829 <li>Crash in XSLT extension elements when the XSLT context node is not
1834 <div class="section" id="id239">
1835 <h1>2.2.4 (2009-11-11)</h1>
1836 <div class="section" id="id240">
1839 <li>Static build of libxml2/libxslt was broken.</li>
1843 <div class="section" id="id241">
1844 <h1>2.2.3 (2009-10-30)</h1>
1845 <div class="section" id="id242">
1846 <h2>Features added</h2>
1848 <div class="section" id="id243">
1851 <li>The <tt class="docutils literal">resolve_entities</tt> option did not work in the incremental feed
1853 <li>Looking up and deleting attributes without a namespace could hit a
1854 namespaced attribute of the same name instead.</li>
1855 <li>Late errors during calls to <tt class="docutils literal">SubElement()</tt> (e.g. attribute related
1856 ones) could leave a partially initialised element in the tree.</li>
1857 <li>Modifying trees that contain parsed entity references could result
1858 in an infinite loop.</li>
1859 <li>ObjectifiedElement.__setattr__ created an empty-string child element when the
1860 attribute value was rejected as a non-unicode/non-ascii string</li>
1861 <li>Syntax errors in <tt class="docutils literal">lxml.cssselect</tt> could result in misleading error
1863 <li>Invalid syntax in CSS expressions could lead to an infinite loop in
1864 the parser of <tt class="docutils literal">lxml.cssselect</tt>.</li>
1865 <li>CSS special character escapes were not properly handled in
1866 <tt class="docutils literal">lxml.cssselect</tt>.</li>
1867 <li>CSS Unicode escapes were not properly decoded in <tt class="docutils literal">lxml.cssselect</tt>.</li>
1868 <li>Select options in HTML forms that had no explicit <tt class="docutils literal">value</tt>
1869 attribute were not handled correctly. The HTML standard dictates
1870 that their value is defined by their text content. This is now
1871 supported by lxml.html.</li>
1872 <li>XPath raised a TypeError when finding CDATA sections. This is now
1873 fully supported.</li>
1874 <li>Calling <tt class="docutils literal">help(lxml.objectify)</tt> didn't work at the prompt.</li>
1875 <li>The <tt class="docutils literal">ElementMaker</tt> in lxml.objectify no longer defines the default
1876 namespaces when annotation is disabled.</li>
1877 <li>Feed parser failed to honour the 'recover' option on parse errors.</li>
1878 <li>Diverting the error logging to Python's logging system was broken.</li>
1881 <div class="section" id="id244">
1882 <h2>Other changes</h2>
1885 <div class="section" id="id245">
1886 <h1>2.2.2 (2009-06-21)</h1>
1887 <div class="section" id="id246">
1888 <h2>Features added</h2>
1890 <li>New helper functions <tt class="docutils literal">strip_attributes()</tt>, <tt class="docutils literal">strip_elements()</tt>,
1891 <tt class="docutils literal">strip_tags()</tt> in lxml.etree to remove attributes/subtrees/tags
1892 from a subtree.</li>
1895 <div class="section" id="id247">
1898 <li>Namespace cleanup on subtree insertions could result in missing
1899 namespace declarations (and potentially crashes) if the element
1900 defining a namespace was deleted and the namespace was not used by
1901 the top element of the inserted subtree but only in deeper subtrees.</li>
1902 <li>Raising an exception from a parser target callback didn't always
1903 terminate the parser.</li>
1904 <li>Only {true, false, 1, 0} are accepted as the lexical representation for
1905 BoolElement ({True, False, T, F, t, f} not any more), restoring lxml <= 2.0
1909 <div class="section" id="id248">
1910 <h2>Other changes</h2>
1913 <div class="section" id="id249">
1914 <h1>2.2.1 (2009-06-02)</h1>
1915 <div class="section" id="id250">
1916 <h2>Features added</h2>
1918 <li>Injecting default attributes into a document during XML Schema
1919 validation (also at parse time).</li>
1920 <li>Pass <tt class="docutils literal">huge_tree</tt> parser option to disable parser security
1921 restrictions imposed by libxml2 2.7.</li>
1924 <div class="section" id="id251">
1927 <li>The script for statically building libxml2 and libxslt didn't work
1929 <li><tt class="docutils literal">XMLSchema()</tt> also passes invalid schema documents on to libxml2
1930 for parsing (which could lead to a crash before release 2.6.24).</li>
1933 <div class="section" id="id252">
1934 <h2>Other changes</h2>
1937 <div class="section" id="id253">
1938 <h1>2.2 (2009-03-21)</h1>
1939 <div class="section" id="id254">
1940 <h2>Features added</h2>
1942 <li>Support for <tt class="docutils literal">standalone</tt> flag in XML declaration through
1943 <tt class="docutils literal">tree.docinfo.standalone</tt> and by passing <tt class="docutils literal">standalone=True/False</tt>
1944 on serialisation.</li>
1947 <div class="section" id="id255">
1950 <li>Crash when parsing an XML Schema with external imports from a
1955 <div class="section" id="beta4-2009-02-27">
1956 <h1>2.2beta4 (2009-02-27)</h1>
1957 <div class="section" id="id256">
1958 <h2>Features added</h2>
1960 <li>Support strings and instantiable Element classes as child arguments
1961 to the constructor of custom Element classes.</li>
1962 <li>GZip compression support for serialisation to files and file-like
1966 <div class="section" id="id257">
1969 <li>Deep-copying an ElementTree copied neither its sibling PIs and
1970 comments nor its internal/external DTD subsets.</li>
1971 <li>Soupparser failed on broken attributes without values.</li>
1972 <li>Crash in XSLT when overwriting an already defined attribute using
1973 <tt class="docutils literal">xsl:attribute</tt>.</li>
1974 <li>Crash bug in exception handling code under Python 3. This was due
1975 to a problem in Cython, not lxml itself.</li>
1976 <li><tt class="docutils literal">lxml.html.FormElement._name()</tt> failed for non top-level forms.</li>
1977 <li><tt class="docutils literal">TAG</tt> special attribute in constructor of custom Element classes
1978 was evaluated incorrectly.</li>
1981 <div class="section" id="id258">
1982 <h2>Other changes</h2>
1984 <li>Official support for Python 3.0.1.</li>
1985 <li><tt class="docutils literal">Element.findtext()</tt> now returns an empty string instead of None
1986 for Elements without text content.</li>
1990 <div class="section" id="beta3-2009-02-17">
1991 <h1>2.2beta3 (2009-02-17)</h1>
1992 <div class="section" id="id259">
1993 <h2>Features added</h2>
1995 <li><tt class="docutils literal">XSLT.strparam()</tt> class method to wrap quoted string parameters
1996 that require escaping.</li>
1999 <div class="section" id="id260">
2002 <li>Memory leak in XPath evaluators.</li>
2003 <li>Crash when parsing indented XML in one thread and merging it with
2004 other documents parsed in another thread.</li>
2005 <li>Setting the <tt class="docutils literal">base</tt> attribute in <tt class="docutils literal">lxml.objectify</tt> from a unicode
2007 <li>Fixes following changes in Python 3.0.1.</li>
2008 <li>Minor fixes for Python 3.</li>
2011 <div class="section" id="id261">
2012 <h2>Other changes</h2>
2014 <li>The global error log (which is copied into the exception log) is now
2015 local to a thread, which fixes some race conditions.</li>
2016 <li>More robust error handling on serialisation.</li>
2020 <div class="section" id="beta2-2009-01-25">
2021 <h1>2.2beta2 (2009-01-25)</h1>
2022 <div class="section" id="id262">
2025 <li>Potential memory leak on exception handling. This was due to a
2026 problem in Cython, not lxml itself.</li>
2027 <li><tt class="docutils literal">iter_links</tt> (and related link-rewriting functions) in
2028 <tt class="docutils literal">lxml.html</tt> would interpret CSS like <tt class="docutils literal"><span class="pre">url("link")</span></tt> incorrectly
2029 (treating the quotation marks as part of the link).</li>
2030 <li>Failing import on systems that have an <tt class="docutils literal">io</tt> module.</li>
2034 <div class="section" id="id263">
2035 <h1>2.1.5 (2009-01-06)</h1>
2036 <div class="section" id="id264">
2039 <li>Potential memory leak on exception handling. This was due to a
2040 problem in Cython, not lxml itself.</li>
2041 <li>Failing import on systems that have an <tt class="docutils literal">io</tt> module.</li>
2045 <div class="section" id="beta1-2008-12-12">
2046 <h1>2.2beta1 (2008-12-12)</h1>
2047 <div class="section" id="id265">
2048 <h2>Features added</h2>
2050 <li>Allow <tt class="docutils literal">lxml.html.diff.htmldiff</tt> to accept Element objects, not
2051 just HTML strings.</li>
2054 <div class="section" id="id266">
2057 <li>Crash when using an XPath evaluator in multiple threads.</li>
2058 <li>Fixed missing whitespace before <tt class="docutils literal"><span class="pre">Link:...</span></tt> in <tt class="docutils literal">lxml.html.diff</tt>.</li>
2061 <div class="section" id="id267">
2062 <h2>Other changes</h2>
2064 <li>Export <tt class="docutils literal">lxml.html.parse</tt>.</li>
2068 <div class="section" id="id268">
2069 <h1>2.1.4 (2008-12-12)</h1>
2070 <div class="section" id="id269">
2073 <li>Crash when using an XPath evaluator in multiple threads.</li>
2077 <div class="section" id="id270">
2078 <h1>2.0.11 (2008-12-12)</h1>
2079 <div class="section" id="id271">
2082 <li>Crash when using an XPath evaluator in multiple threads.</li>
2086 <div class="section" id="alpha1-2008-11-23">
2087 <h1>2.2alpha1 (2008-11-23)</h1>
2088 <div class="section" id="id272">
2089 <h2>Features added</h2>
2091 <li>Support for XSLT result tree fragments in XPath/XSLT extension
2093 <li>QName objects have new properties <tt class="docutils literal">namespace</tt> and <tt class="docutils literal">localname</tt>.</li>
2094 <li>New options for exclusive C14N and C14N without comments.</li>
2095 <li>Instantiating a custom Element classes creates a new Element.</li>
2098 <div class="section" id="id273">
2101 <li>XSLT didn't inherit the parse options of the input document.</li>
2102 <li>0-bytes could slip through the API when used inside of Unicode
2104 <li>With <tt class="docutils literal">lxml.html.clean.autolink</tt>, links with balanced parenthesis,
2105 that end in a parenthesis, will be linked in their entirety (typical
2106 with Wikipedia links).</li>
2109 <div class="section" id="id274">
2110 <h2>Other changes</h2>
2113 <div class="section" id="id275">
2114 <h1>2.1.3 (2008-11-17)</h1>
2115 <div class="section" id="id276">
2116 <h2>Features added</h2>
2118 <div class="section" id="id277">
2121 <li>Ref-count leaks when lxml enters a try-except statement while an
2122 outside exception lives in sys.exc_*(). This was due to a problem in
2123 Cython, not lxml itself.</li>
2124 <li>Parser Unicode decoding errors could get swallowed by other
2126 <li>Name/import errors in some Python modules.</li>
2127 <li>Internal DTD subsets that did not specify a system or public ID were
2128 not serialised and did not appear in the docinfo property of
2130 <li>Fix a pre-Py3k warning when parsing from a gzip file in Py2.6.</li>
2131 <li>Test suite fixes for libxml2 2.7.</li>
2132 <li>Resolver.resolve_string() did not work for non-ASCII byte strings.</li>
2133 <li>Resolver.resolve_file() was broken.</li>
2134 <li>Overriding the parser encoding didn't work for many encodings.</li>
2137 <div class="section" id="id278">
2138 <h2>Other changes</h2>
2141 <div class="section" id="id279">
2142 <h1>2.0.10 (2008-11-17)</h1>
2143 <div class="section" id="id280">
2146 <li>Ref-count leaks when lxml enters a try-except statement while an
2147 outside exception lives in sys.exc_*(). This was due to a problem in
2148 Cython, not lxml itself.</li>
2152 <div class="section" id="id281">
2153 <h1>2.1.2 (2008-09-05)</h1>
2154 <div class="section" id="id282">
2155 <h2>Features added</h2>
2157 <li>lxml.etree now tries to find the absolute path name of files when
2158 parsing from a file-like object. This helps custom resolvers when
2159 resolving relative URLs, as lixbml2 can prepend them with the path
2160 of the source document.</li>
2163 <div class="section" id="id283">
2166 <li>Memory problem when passing documents between threads.</li>
2167 <li>Target parser did not honour the <tt class="docutils literal">recover</tt> option and raised an
2168 exception instead of calling <tt class="docutils literal">.close()</tt> on the target.</li>
2171 <div class="section" id="id284">
2172 <h2>Other changes</h2>
2175 <div class="section" id="id285">
2176 <h1>2.0.9 (2008-09-05)</h1>
2177 <div class="section" id="id286">
2180 <li>Memory problem when passing documents between threads.</li>
2181 <li>Target parser did not honour the <tt class="docutils literal">recover</tt> option and raised an
2182 exception instead of calling <tt class="docutils literal">.close()</tt> on the target.</li>
2186 <div class="section" id="id287">
2187 <h1>2.1.1 (2008-07-24)</h1>
2188 <div class="section" id="id288">
2189 <h2>Features added</h2>
2191 <div class="section" id="id289">
2194 <li>Crash when parsing XSLT stylesheets in a thread and using them in
2196 <li>Encoding problem when including text with ElementInclude under
2200 <div class="section" id="id290">
2201 <h2>Other changes</h2>
2204 <div class="section" id="id291">
2205 <h1>2.0.8 (2008-07-24)</h1>
2206 <div class="section" id="id292">
2207 <h2>Features added</h2>
2209 <li><tt class="docutils literal">lxml.html.rewrite_links()</tt> strips links to work around documents
2210 with whitespace in URL attributes.</li>
2213 <div class="section" id="id293">
2216 <li>Crash when parsing XSLT stylesheets in a thread and using them in
2218 <li>CSS selector parser dropped remaining expression after a function
2219 with parameters.</li>
2222 <div class="section" id="id294">
2223 <h2>Other changes</h2>
2226 <div class="section" id="id295">
2227 <h1>2.1 (2008-07-09)</h1>
2228 <div class="section" id="id296">
2229 <h2>Features added</h2>
2231 <li>Smart strings can be switched off in XPath (<tt class="docutils literal">smart_strings</tt>
2232 keyword option).</li>
2233 <li><tt class="docutils literal">lxml.html.rewrite_links()</tt> strips links to work around documents
2234 with whitespace in URL attributes.</li>
2237 <div class="section" id="id297">
2240 <li>Custom resolvers were not used for XMLSchema includes/imports and
2241 XInclude processing.</li>
2242 <li>CSS selector parser dropped remaining expression after a function
2243 with parameters.</li>
2246 <div class="section" id="id298">
2247 <h2>Other changes</h2>
2249 <li><tt class="docutils literal">objectify.enableRecursiveStr()</tt> was removed, use
2250 <tt class="docutils literal">objectify.enable_recursive_str()</tt> instead</li>
2251 <li>Speed-up when running XSLTs on documents from other threads</li>
2255 <div class="section" id="id299">
2256 <h1>2.0.7 (2008-06-20)</h1>
2257 <div class="section" id="id300">
2258 <h2>Features added</h2>
2260 <li>Pickling <tt class="docutils literal">ElementTree</tt> objects in lxml.objectify.</li>
2263 <div class="section" id="id301">
2266 <li>Descending dot-separated classes in CSS selectors were not resolved
2268 <li><tt class="docutils literal">ElementTree.parse()</tt> didn't handle target parser result.</li>
2269 <li>Potential threading problem in XInclude.</li>
2270 <li>Crash in Element class lookup classes when the __init__() method of
2271 the super class is not called from Python subclasses.</li>
2274 <div class="section" id="id302">
2275 <h2>Other changes</h2>
2277 <li>Non-ASCII characters in attribute values are no longer escaped on
2282 <div class="section" id="beta3-2008-06-19">
2283 <h1>2.1beta3 (2008-06-19)</h1>
2284 <div class="section" id="id303">
2285 <h2>Features added</h2>
2287 <li>Major overhaul of <tt class="docutils literal">tools/xpathgrep.py</tt> script.</li>
2288 <li>Pickling <tt class="docutils literal">ElementTree</tt> objects in lxml.objectify.</li>
2289 <li>Support for parsing from file-like objects that return unicode
2291 <li>New function <tt class="docutils literal">etree.cleanup_namespaces(el)</tt> that removes unused
2292 namespace declarations from a (sub)tree (experimental).</li>
2293 <li>XSLT results support the buffer protocol in Python 3.</li>
2294 <li>Polymorphic functions in <tt class="docutils literal">lxml.html</tt> that accept either a tree or
2295 a parsable string will return either a UTF-8 encoded byte string, a
2296 unicode string or a tree, based on the type of the input.
2297 Previously, the result was always a byte string or a tree.</li>
2298 <li>Support for Python 2.6 and 3.0 beta.</li>
2299 <li>File name handling now uses a heuristic to convert between byte
2300 strings (usually filenames) and unicode strings (usually URLs).</li>
2301 <li>Parsing from a plain file object frees the GIL under Python 2.x.</li>
2302 <li>Running <tt class="docutils literal">iterparse()</tt> on a plain file (or filename) frees the GIL
2303 on reading under Python 2.x.</li>
2304 <li>Conversion functions <tt class="docutils literal">html_to_xhtml()</tt> and <tt class="docutils literal">xhtml_to_html()</tt> in
2305 lxml.html (experimental).</li>
2306 <li>Most features in lxml.html work for XHTML namespaced tag names
2307 (experimental).</li>
2310 <div class="section" id="id304">
2313 <li><tt class="docutils literal">ElementTree.parse()</tt> didn't handle target parser result.</li>
2314 <li>Crash in Element class lookup classes when the __init__() method of
2315 the super class is not called from Python subclasses.</li>
2316 <li>A number of problems related to unicode/byte string conversion of
2317 filenames and error messages were fixed.</li>
2318 <li>Building on MacOS-X now passes the "flat_namespace" option to the C
2319 compiler, which reportedly prevents build quirks and crashes on this
2321 <li>Windows build was broken.</li>
2322 <li>Rare crash when serialising to a file object with certain encodings.</li>
2325 <div class="section" id="id305">
2326 <h2>Other changes</h2>
2328 <li>Non-ASCII characters in attribute values are no longer escaped on
2330 <li>Passing non-ASCII byte strings or invalid unicode strings as .tag,
2331 namespaces, etc. will result in a ValueError instead of an
2332 AssertionError (just like the tag well-formedness check).</li>
2333 <li>Up to several times faster attribute access (i.e. tree traversal) in
2334 lxml.objectify.</li>
2338 <div class="section" id="id306">
2339 <h1>2.0.6 (2008-05-31)</h1>
2340 <div class="section" id="id307">
2341 <h2>Features added</h2>
2343 <div class="section" id="id308">
2346 <li>Incorrect evaluation of <tt class="docutils literal"><span class="pre">el.find("tag[child]")</span></tt>.</li>
2347 <li>Windows build was broken.</li>
2348 <li>Moving a subtree from a document created in one thread into a
2349 document of another thread could crash when the rest of the source
2350 document is deleted while the subtree is still in use.</li>
2351 <li>Rare crash when serialising to a file object with certain encodings.</li>
2354 <div class="section" id="id309">
2355 <h2>Other changes</h2>
2357 <li>lxml should now build without problems on MacOS-X.</li>
2361 <div class="section" id="beta2-2008-05-02">
2362 <h1>2.1beta2 (2008-05-02)</h1>
2363 <div class="section" id="id310">
2364 <h2>Features added</h2>
2366 <li>All parse functions in lxml.html take a <tt class="docutils literal">parser</tt> keyword argument.</li>
2367 <li>lxml.html has a new parser class <tt class="docutils literal">XHTMLParser</tt> and a module
2368 attribute <tt class="docutils literal">xhtml_parser</tt> that provide XML parsers that are
2369 pre-configured for the lxml.html package.</li>
2372 <div class="section" id="id311">
2375 <li>Moving a subtree from a document created in one thread into a
2376 document of another thread could crash when the rest of the source
2377 document is deleted while the subtree is still in use.</li>
2378 <li>Passing an nsmap when creating an Element will no longer strip
2379 redundantly defined namespace URIs. This prevented the definition
2380 of more than one prefix for a namespace on the same Element.</li>
2383 <div class="section" id="id312">
2384 <h2>Other changes</h2>
2386 <li>If the default namespace is redundantly defined with a prefix on the
2387 same Element, the prefix will now be preferred for subelements and
2388 attributes. This allows users to work around a problem in libxml2
2389 where attributes from the default namespace could serialise without
2390 a prefix even when they appear on an Element with a different
2391 namespace (i.e. they would end up in the wrong namespace).</li>
2395 <div class="section" id="id313">
2396 <h1>2.0.5 (2008-05-01)</h1>
2397 <div class="section" id="id314">
2398 <h2>Features added</h2>
2400 <div class="section" id="id315">
2403 <li>Resolving to a filename in custom resolvers didn't work.</li>
2404 <li>lxml did not honour libxslt's second error state "STOPPED", which
2405 let some XSLT errors pass silently.</li>
2406 <li>Memory leak in Schematron with libxml2 >= 2.6.31.</li>
2409 <div class="section" id="id316">
2410 <h2>Other changes</h2>
2413 <div class="section" id="beta1-2008-04-15">
2414 <h1>2.1beta1 (2008-04-15)</h1>
2415 <div class="section" id="id317">
2416 <h2>Features added</h2>
2418 <li>Error logging in Schematron (requires libxml2 2.6.32 or later).</li>
2419 <li>Parser option <tt class="docutils literal">strip_cdata</tt> for normalising or keeping CDATA
2420 sections. Defaults to <tt class="docutils literal">True</tt> as before, thus replacing CDATA
2421 sections by their text content.</li>
2422 <li><tt class="docutils literal">CDATA()</tt> factory to wrap string content as CDATA section.</li>
2425 <div class="section" id="id318">
2428 <li>Resolving to a filename in custom resolvers didn't work.</li>
2429 <li>lxml did not honour libxslt's second error state "STOPPED", which
2430 let some XSLT errors pass silently.</li>
2431 <li>Memory leak in Schematron with libxml2 >= 2.6.31.</li>
2432 <li>lxml.etree accepted non well-formed namespace prefix names.</li>
2435 <div class="section" id="id319">
2436 <h2>Other changes</h2>
2438 <li>Major cleanup in internal <tt class="docutils literal">moveNodeToDocument()</tt> function, which
2439 takes care of namespace cleanup when moving elements between
2440 different namespace contexts.</li>
2441 <li>New Elements created through the <tt class="docutils literal">makeelement()</tt> method of an HTML
2442 parser or through lxml.html now end up in a new HTML document
2443 (doctype HTML 4.01 Transitional) instead of a generic XML document.
2444 This mostly impacts the serialisation and the availability of a DTD
2449 <div class="section" id="id320">
2450 <h1>2.0.4 (2008-04-13)</h1>
2451 <div class="section" id="id321">
2452 <h2>Features added</h2>
2454 <div class="section" id="id322">
2457 <li>Hanging thread in conjunction with GTK threading.</li>
2458 <li>Crash bug in iterparse when moving elements into other documents.</li>
2459 <li>HTML elements' <tt class="docutils literal">.cssselect()</tt> method was broken.</li>
2460 <li><tt class="docutils literal"><span class="pre">ElementTree.find*()</span></tt> didn't accept QName objects.</li>
2463 <div class="section" id="id323">
2464 <h2>Other changes</h2>
2467 <div class="section" id="alpha1-2008-03-27">
2468 <h1>2.1alpha1 (2008-03-27)</h1>
2469 <div class="section" id="id324">
2470 <h2>Features added</h2>
2472 <li>New event types 'comment' and 'pi' in <tt class="docutils literal">iterparse()</tt>.</li>
2473 <li><tt class="docutils literal">XSLTAccessControl</tt> instances have a property <tt class="docutils literal">options</tt> that
2474 returns a dict of access configuration options.</li>
2475 <li>Constant instances <tt class="docutils literal">DENY_ALL</tt> and <tt class="docutils literal">DENY_WRITE</tt> on
2476 <tt class="docutils literal">XSLTAccessControl</tt> class.</li>
2477 <li>Extension elements for XSLT (experimental!)</li>
2478 <li><tt class="docutils literal">Element.base</tt> property returns the xml:base or HTML base URL of
2480 <li><tt class="docutils literal">docinfo.URL</tt> property is writable.</li>
2483 <div class="section" id="id325">
2486 <li>Default encoding for plain text serialisation was different from
2487 that of XML serialisation (UTF-8 instead of ASCII).</li>
2490 <div class="section" id="id326">
2491 <h2>Other changes</h2>
2493 <li>Minor API speed-ups.</li>
2494 <li>The benchmark suite now uses tail text in the trees, which makes the
2495 absolute numbers incomparable to previous results.</li>
2496 <li>Generating the HTML documentation now requires <a class="reference external" href="http://pygments.org/">Pygments</a>, which is
2497 used to enable syntax highlighting for the doctest examples.</li>
2499 <p>Most long-time deprecated functions and methods were removed:</p>
2501 <li><p class="first"><tt class="docutils literal">etree.clearErrorLog()</tt>, use <tt class="docutils literal">etree.clear_error_log()</tt></p>
2503 <li><p class="first"><tt class="docutils literal">etree.useGlobalPythonLog()</tt>, use
2504 <tt class="docutils literal">etree.use_global_python_log()</tt></p>
2506 <li><p class="first"><tt class="docutils literal">etree.ElementClassLookup.setFallback()</tt>, use
2507 <tt class="docutils literal">etree.ElementClassLookup.set_fallback()</tt></p>
2509 <li><p class="first"><tt class="docutils literal">etree.getDefaultParser()</tt>, use <tt class="docutils literal">etree.get_default_parser()</tt></p>
2511 <li><p class="first"><tt class="docutils literal">etree.setDefaultParser()</tt>, use <tt class="docutils literal">etree.set_default_parser()</tt></p>
2513 <li><p class="first"><tt class="docutils literal">etree.setElementClassLookup()</tt>, use
2514 <tt class="docutils literal">etree.set_element_class_lookup()</tt></p>
2515 <p>Note that <tt class="docutils literal">parser.setElementClassLookup()</tt> has not been removed
2516 yet, although <tt class="docutils literal">parser.set_element_class_lookup()</tt> should be used
2519 <li><p class="first"><tt class="docutils literal">xpath_evaluator.registerNamespace()</tt>, use
2520 <tt class="docutils literal">xpath_evaluator.register_namespace()</tt></p>
2522 <li><p class="first"><tt class="docutils literal">xpath_evaluator.registerNamespaces()</tt>, use
2523 <tt class="docutils literal">xpath_evaluator.register_namespaces()</tt></p>
2525 <li><p class="first"><tt class="docutils literal">objectify.setPytypeAttributeTag</tt>, use
2526 <tt class="docutils literal">objectify.set_pytype_attribute_tag</tt></p>
2528 <li><p class="first"><tt class="docutils literal">objectify.setDefaultParser()</tt>, use
2529 <tt class="docutils literal">objectify.set_default_parser()</tt></p>
2534 <div class="section" id="id327">
2535 <h1>2.0.3 (2008-03-26)</h1>
2536 <div class="section" id="id328">
2537 <h2>Features added</h2>
2539 <li>soupparser.parse() allows passing keyword arguments on to
2541 <li><tt class="docutils literal">fromstring()</tt> method in <tt class="docutils literal">lxml.html.soupparser</tt>.</li>
2544 <div class="section" id="id329">
2547 <li><tt class="docutils literal">lxml.html.diff</tt> didn't treat empty tags properly (e.g.,
2548 <tt class="docutils literal"><br></tt>).</li>
2549 <li>Handle entity replacements correctly in target parser.</li>
2550 <li>Crash when using <tt class="docutils literal">iterparse()</tt> with XML Schema validation.</li>
2551 <li>The BeautifulSoup parser (soupparser.py) did not replace entities,
2552 which made them turn up in text content.</li>
2553 <li>Attribute assignment of custom PyTypes in objectify could fail to
2554 correctly serialise the value to a string.</li>
2557 <div class="section" id="id330">
2558 <h2>Other changes</h2>
2560 <li><tt class="docutils literal">lxml.html.ElementSoup</tt> was replaced by a new module
2561 <tt class="docutils literal">lxml.html.soupparser</tt> with a more consistent API. The old module
2562 remains for compatibility with ElementTree's own ElementSoup module.</li>
2563 <li>Setting the XSLT_CONFIG and XML2_CONFIG environment variables at
2564 build time will let setup.py pick up the <tt class="docutils literal"><span class="pre">xml2-config</span></tt> and
2565 <tt class="docutils literal"><span class="pre">xslt-config</span></tt> scripts from the supplied path name.</li>
2566 <li>Passing <tt class="docutils literal"><span class="pre">--with-xml2-config=/path/to/xml2-config</span></tt> to setup.py will
2567 override the <tt class="docutils literal"><span class="pre">xml2-config</span></tt> script that is used to determine the C
2568 compiler options. The same applies for the <tt class="docutils literal"><span class="pre">--with-xslt-config</span></tt>
2573 <div class="section" id="id331">
2574 <h1>2.0.2 (2008-02-22)</h1>
2575 <div class="section" id="id332">
2576 <h2>Features added</h2>
2578 <li>Support passing <tt class="docutils literal">base_url</tt> to file parser functions to override
2579 the filename of the file(-like) object.</li>
2582 <div class="section" id="id333">
2585 <li>The prefix for objectify's pytype namespace was missing from the set
2586 of default prefixes.</li>
2587 <li>Memory leak in Schematron (fixed only for libxml2 2.6.31+).</li>
2588 <li>Error type names in RelaxNG were reported incorrectly.</li>
2589 <li>Slice deletion bug fixed in objectify.</li>
2592 <div class="section" id="id334">
2593 <h2>Other changes</h2>
2595 <li>Enabled doctests for some Python modules (especially <tt class="docutils literal">lxml.html</tt>).</li>
2596 <li>Add a <tt class="docutils literal">method</tt> argument to <tt class="docutils literal">lxml.html.tostring()</tt>
2597 (<tt class="docutils literal"><span class="pre">method="xml"</span></tt> for XHTML output).</li>
2598 <li>Make it clearer that methods like <tt class="docutils literal">lxml.html.fromstring()</tt> take a
2599 <tt class="docutils literal">base_url</tt> argument.</li>
2603 <div class="section" id="id335">
2604 <h1>2.0.1 (2008-02-13)</h1>
2605 <div class="section" id="id336">
2606 <h2>Features added</h2>
2608 <li>Child iteration in <tt class="docutils literal">lxml.pyclasslookup</tt>.</li>
2609 <li>Loads of new docstrings reflect the signature of functions and
2610 methods to make them visible in API docs and <tt class="docutils literal">help()</tt></li>
2613 <div class="section" id="id337">
2616 <li>The module <tt class="docutils literal">lxml.html.builder</tt> was duplicated as
2617 <tt class="docutils literal">lxml.htmlbuilder</tt></li>
2618 <li>Form elements would return None for <tt class="docutils literal">form.fields.keys()</tt> if there
2619 was an unnamed input field. Now unnamed input fields are completely
2621 <li>Setting an element slice in objectify could insert slice-overlapping
2622 elements at the wrong position.</li>
2625 <div class="section" id="id338">
2626 <h2>Other changes</h2>
2628 <li>The generated API documentation was cleaned up and disburdened from
2629 non-public classes etc.</li>
2630 <li>The previously public module <tt class="docutils literal">lxml.html.setmixin</tt> was renamed to
2631 <tt class="docutils literal">lxml.html._setmixin</tt> as it is not an official part of lxml. If
2632 you want to use it, feel free to copy it over to your own source
2634 <li>Passing <tt class="docutils literal"><span class="pre">--with-xslt-config=/path/to/xslt-config</span></tt> to setup.py will
2635 override the <tt class="docutils literal"><span class="pre">xslt-config</span></tt> script that is used to determine the C
2636 compiler options.</li>
2640 <div class="section" id="id339">
2641 <h1>2.0 (2008-02-01)</h1>
2642 <div class="section" id="id340">
2643 <h2>Features added</h2>
2645 <li>Passing the <tt class="docutils literal">unicode</tt> type as <tt class="docutils literal">encoding</tt> to <tt class="docutils literal">tostring()</tt> will
2646 serialise to unicode. The <tt class="docutils literal">tounicode()</tt> function is now
2648 <li><tt class="docutils literal">XMLSchema()</tt> and <tt class="docutils literal">RelaxNG()</tt> can parse from StringIO.</li>
2649 <li><tt class="docutils literal">makeparser()</tt> function in <tt class="docutils literal">lxml.objectify</tt> to create a new
2650 parser with the usual objectify setup.</li>
2651 <li>Plain ASCII XPath string results are no longer forced into unicode
2652 objects as in 2.0beta1, but are returned as plain strings as before.</li>
2653 <li>All XPath string results are 'smart' objects that have a
2654 <tt class="docutils literal">getparent()</tt> method to retrieve their parent Element.</li>
2655 <li><tt class="docutils literal">with_tail</tt> option in serialiser functions.</li>
2656 <li>More accurate exception messages in validator creation.</li>
2657 <li>Parse-time XML schema validation (<tt class="docutils literal">schema</tt> parser keyword).</li>
2658 <li>XPath string results of the <tt class="docutils literal">text()</tt> function and attribute
2659 selection make their Element container accessible through a
2660 <tt class="docutils literal">getparent()</tt> method. As a side-effect, they are now always
2661 unicode objects (even ASCII strings).</li>
2662 <li><tt class="docutils literal">XSLT</tt> objects are usable in any thread - at the cost of a deep
2663 copy if they were not created in that thread.</li>
2664 <li>Invalid entity names and character references will be rejected by
2665 the <tt class="docutils literal">Entity()</tt> factory.</li>
2666 <li><tt class="docutils literal">entity.text</tt> returns the textual representation of the entity,
2667 e.g. <tt class="docutils literal">&amp;</tt>.</li>
2668 <li>New properties <tt class="docutils literal">position</tt> and <tt class="docutils literal">code</tt> on ParseError exception (as
2670 <li>Rich comparison of <tt class="docutils literal">element.attrib</tt> proxies.</li>
2671 <li>ElementTree compatible TreeBuilder class.</li>
2672 <li>Use default prefixes for some common XML namespaces.</li>
2673 <li><tt class="docutils literal">lxml.html.clean.Cleaner</tt> now allows for a <tt class="docutils literal">host_whitelist</tt>, and
2674 two overridable methods: <tt class="docutils literal">allow_embedded_url(el, url)</tt> and the
2675 more general <tt class="docutils literal">allow_element(el)</tt>.</li>
2676 <li>Extended slicing of Elements as in <tt class="docutils literal"><span class="pre">element[1:-1:2]</span></tt>, both in
2677 etree and in objectify</li>
2678 <li>Resolvers can now provide a <tt class="docutils literal">base_url</tt> keyword argument when
2679 resolving a document as string data.</li>
2680 <li>When using <tt class="docutils literal">lxml.doctestcompare</tt> you can give the doctest option
2681 <tt class="docutils literal">NOPARSE_MARKUP</tt> (like <tt class="docutils literal"># doctest: +NOPARSE_MARKUP</tt>) to suppress
2682 the special checking for one test.</li>
2683 <li>Separate <tt class="docutils literal">feed_error_log</tt> property for the feed parser interface.
2684 The normal parser interface and <tt class="docutils literal">iterparse</tt> continue to use
2685 <tt class="docutils literal">error_log</tt>.</li>
2686 <li>The normal parsers and the feed parser interface are now separated
2687 and can be used concurrently on the same parser instance.</li>
2688 <li><tt class="docutils literal">fromstringlist()</tt> and <tt class="docutils literal">tostringlist()</tt> functions as in
2689 ElementTree 1.3</li>
2690 <li><tt class="docutils literal">iterparse()</tt> accepts an <tt class="docutils literal">html</tt> boolean keyword argument for
2691 parsing with the HTML parser (note that this interface may be
2692 subject to change)</li>
2693 <li>Parsers accept an <tt class="docutils literal">encoding</tt> keyword argument that overrides the encoding
2694 of the parsed documents.</li>
2695 <li>New C-API function <tt class="docutils literal">hasChild()</tt> to test for children</li>
2696 <li><tt class="docutils literal">annotate()</tt> function in objectify can annotate with Python types and XSI
2697 types in one step. Accompanied by <tt class="docutils literal">xsiannotate()</tt> and <tt class="docutils literal">pyannotate()</tt>.</li>
2698 <li><tt class="docutils literal">ET.write()</tt>, <tt class="docutils literal">tostring()</tt> and <tt class="docutils literal">tounicode()</tt> now accept a keyword
2699 argument <tt class="docutils literal">method</tt> that can be one of 'xml' (or None), 'html' or 'text' to
2700 serialise as XML, HTML or plain text content.</li>
2701 <li><tt class="docutils literal">iterfind()</tt> method on Elements returns an iterator equivalent to
2702 <tt class="docutils literal">findall()</tt></li>
2703 <li><tt class="docutils literal">itertext()</tt> method on Elements</li>
2704 <li>Setting a QName object as value of the .text property or as an attribute
2705 will resolve its prefix in the respective context</li>
2706 <li>ElementTree-like parser target interface as described in
2707 <a class="reference external" href="http://effbot.org/elementtree/elementtree-xmlparser.htm">http://effbot.org/elementtree/elementtree-xmlparser.htm</a></li>
2708 <li>ElementTree-like feed parser interface on XMLParser and HTMLParser
2709 (<tt class="docutils literal">feed()</tt> and <tt class="docutils literal">close()</tt> methods)</li>
2710 <li>Reimplemented <tt class="docutils literal">objectify.E</tt> for better performance and improved
2711 integration with objectify. Provides extended type support based on
2712 registered PyTypes.</li>
2713 <li>XSLT objects now support deep copying</li>
2714 <li>New <tt class="docutils literal">makeSubElement()</tt> C-API function that allows creating a new
2715 subelement straight with text, tail and attributes.</li>
2716 <li>XPath extension functions can now access the current context node
2717 (<tt class="docutils literal">context.context_node</tt>) and use a context dictionary
2718 (<tt class="docutils literal">context.eval_context</tt>) from the context provided in their first
2720 <li>HTML tag soup parser based on BeautifulSoup in <tt class="docutils literal">lxml.html.ElementSoup</tt></li>
2721 <li>New module <tt class="docutils literal">lxml.doctestcompare</tt> by Ian Bicking for writing simplified
2722 doctests based on XML/HTML output. Use by importing <tt class="docutils literal">lxml.usedoctest</tt> or
2723 <tt class="docutils literal">lxml.html.usedoctest</tt> from within a doctest.</li>
2724 <li>New module <tt class="docutils literal">lxml.cssselect</tt> by Ian Bicking for selecting Elements with CSS
2726 <li>New package <tt class="docutils literal">lxml.html</tt> written by Ian Bicking for advanced HTML
2728 <li>Namespace class setup is now local to the <tt class="docutils literal">ElementNamespaceClassLookup</tt>
2729 instance and no longer global.</li>
2730 <li>Schematron validation (incomplete in libxml2)</li>
2731 <li>Additional <tt class="docutils literal">stringify</tt> argument to <tt class="docutils literal">objectify.PyType()</tt> takes a
2732 conversion function to strings to support setting text values from arbitrary
2734 <li>Entity support through an <tt class="docutils literal">Entity</tt> factory and element classes. XML
2735 parsers now have a <tt class="docutils literal">resolve_entities</tt> keyword argument that can be set to
2736 False to keep entities in the document.</li>
2737 <li><tt class="docutils literal">column</tt> field on error log entries to accompany the <tt class="docutils literal">line</tt> field</li>
2738 <li>Error specific messages in XPath parsing and evaluation
2739 NOTE: for evaluation errors, you will now get an XPathEvalError instead of
2740 an XPathSyntaxError. To catch both, you can except on <tt class="docutils literal">XPathError</tt></li>
2741 <li>The regular expression functions in XPath now support passing a node-set
2742 instead of a string</li>
2743 <li>Extended type annotation in objectify: new <tt class="docutils literal">xsiannotate()</tt> function</li>
2744 <li>EXSLT RegExp support in standard XPath (not only XSLT)</li>
2747 <div class="section" id="id341">
2750 <li>Missing import in <tt class="docutils literal">lxml.html.clean</tt>.</li>
2751 <li>Some Python 2.4-isms prevented lxml from building/running under
2753 <li>XPath on ElementTrees could crash when selecting the virtual root
2754 node of the ElementTree.</li>
2755 <li>Compilation <tt class="docutils literal"><span class="pre">--without-threading</span></tt> was buggy in alpha5/6.</li>
2756 <li>Memory leak in the <tt class="docutils literal">parse()</tt> function.</li>
2757 <li>Minor bugs in XSLT error message formatting.</li>
2758 <li>Result document memory leak in target parser.</li>
2759 <li>Target parser failed to report comments.</li>
2760 <li>In the <tt class="docutils literal">lxml.html</tt> <tt class="docutils literal">iter_links</tt> method, links in <tt class="docutils literal"><object></tt>
2761 tags weren't recognized. (Note: plugin-specific link parameters
2762 still aren't recognized.) Also, the <tt class="docutils literal"><embed></tt> tag, though not
2763 standard, is now included in <tt class="docutils literal">lxml.html.defs.special_inline_tags</tt>.</li>
2764 <li>Using custom resolvers on XSLT stylesheets parsed from a string
2765 could request ill-formed URLs.</li>
2766 <li>With <tt class="docutils literal">lxml.doctestcompare</tt> if you do <tt class="docutils literal"><tag <span class="pre">xmlns="..."></span></tt> in your
2767 output, it will then be namespace-neutral (before the ellipsis was
2768 treated as a real namespace).</li>
2769 <li>AttributeError in feed parser on parse errors</li>
2770 <li>XML feed parser setup problem</li>
2771 <li>Type annotation for unicode strings in <tt class="docutils literal">DataElement()</tt></li>
2772 <li>lxml failed to serialise namespace declarations of elements other than the
2773 root node of a tree</li>
2774 <li>Race condition in XSLT where the resolver context leaked between concurrent
2776 <li>lxml.etree did not check tag/attribute names</li>
2777 <li>The XML parser did not report undefined entities as error</li>
2778 <li>The text in exceptions raised by XML parsers, validators and XPath
2779 evaluators now reports the first error that occurred instead of the last</li>
2780 <li>Passing '' as XPath namespace prefix did not raise an error</li>
2781 <li>Thread safety in XPath evaluators</li>
2784 <div class="section" id="id342">
2785 <h2>Other changes</h2>
2787 <li>Exceptions carry only the part of the error log that is related to
2788 the operation that caused the error.</li>
2789 <li><tt class="docutils literal">XMLSchema()</tt> and <tt class="docutils literal">RelaxNG()</tt> now enforce passing the source
2790 file/filename through the <tt class="docutils literal">file</tt> keyword argument.</li>
2791 <li>The test suite now skips most doctests under Python 2.3.</li>
2792 <li><tt class="docutils literal">make clean</tt> no longer removes the .c files (use <tt class="docutils literal">make
2793 realclean</tt> instead)</li>
2794 <li>Minor performance tweaks for Element instantiation and subelement
2796 <li>Various places in the XPath, XSLT and iteration APIs now require
2797 keyword-only arguments.</li>
2798 <li>The argument order in <tt class="docutils literal">element.itersiblings()</tt> was changed to
2799 match the order used in all other iteration methods. The second
2800 argument ('preceding') is now a keyword-only argument.</li>
2801 <li>The <tt class="docutils literal">getiterator()</tt> method on Elements and ElementTrees was
2802 reverted to return an iterator as it did in lxml 1.x. The ET API
2803 specification allows it to return either a sequence or an iterator,
2804 and it traditionally returned a sequence in ET and an iterator in
2805 lxml. However, it is now deprecated in favour of the <tt class="docutils literal">iter()</tt>
2806 method, which should be used in new code wherever possible.</li>
2807 <li>The 'pretty printed' serialisation of ElementTree objects now
2808 inserts newlines at the root level between processing instructions,
2809 comments and the root tag.</li>
2810 <li>A 'pretty printed' serialisation is now terminated with a newline.</li>
2811 <li>Second argument to <tt class="docutils literal">lxml.etree.Extension()</tt> helper is no longer
2812 required, third argument is now a keyword-only argument <tt class="docutils literal">ns</tt>.</li>
2813 <li><tt class="docutils literal">lxml.html.tostring</tt> takes an <tt class="docutils literal">encoding</tt> argument.</li>
2814 <li>The module source files were renamed to "lxml.*.pyx", such as
2815 "lxml.etree.pyx". This was changed for consistency with the way
2816 Pyrex commonly handles package imports. The main effect is that
2817 classes now know about their fully qualified class name, including
2818 the package name of their module.</li>
2819 <li>Keyword-only arguments in some API functions, especially in the
2820 parsers and serialisers.</li>
2821 <li>Tag name validation in lxml.etree (and lxml.html) now distinguishes
2822 between HTML tags and XML tags based on the parser that was used to
2823 parse or create them. HTML tags no longer reject any non-ASCII
2824 characters in tag names but only spaces and the special characters
2825 <tt class="docutils literal"><span class="pre"><>&/"'</span></tt>.</li>
2826 <li>lxml.etree now emits a warning if you use XPath with libxml2 2.6.27
2827 (which can crash on certain XPath errors)</li>
2828 <li>Type annotation in objectify now preserves the already annotated type by
2829 default to prevent losing type information that is already there.</li>
2830 <li><tt class="docutils literal">element.getiterator()</tt> returns a list, use <tt class="docutils literal">element.iter()</tt> to retrieve
2831 an iterator (ElementTree 1.3 compatible behaviour)</li>
2832 <li>objectify.PyType for None is now called "NoneType"</li>
2833 <li><tt class="docutils literal">el.getiterator()</tt> renamed to <tt class="docutils literal">el.iter()</tt>, following ElementTree 1.3 -
2834 original name is still available as alias</li>
2835 <li>In the public C-API, <tt class="docutils literal">findOrBuildNodeNs()</tt> was replaced by the more
2836 generic <tt class="docutils literal">findOrBuildNodeNsPrefix</tt></li>
2837 <li>Major refactoring in XPath/XSLT extension function code</li>
2838 <li>Network access in parsers disabled by default</li>
2842 <div class="section" id="id343">
2843 <h1>1.3.6 (2007-10-29)</h1>
2844 <div class="section" id="id344">
2847 <li>Backported decref crash fix from 2.0</li>
2848 <li>Well hidden free-while-in-use crash bug in ObjectPath</li>
2851 <div class="section" id="id345">
2852 <h2>Other changes</h2>
2854 <li>The test suites now run <tt class="docutils literal">gc.collect()</tt> in the <tt class="docutils literal">tearDown()</tt>
2855 methods. While this makes them take a lot longer to run, it also
2856 makes it easier to link a specific test to garbage collection
2857 problems that would otherwise appear in later tests.</li>
2861 <div class="section" id="id346">
2862 <h1>1.3.5 (2007-10-22)</h1>
2863 <div class="section" id="id347">
2864 <h2>Features added</h2>
2866 <div class="section" id="id348">
2869 <li>lxml.etree could crash when adding more than 10000 namespaces to a
2871 <li>lxml failed to serialise namespace declarations of elements other
2872 than the root node of a tree</li>
2876 <div class="section" id="id349">
2877 <h1>1.3.4 (2007-08-30)</h1>
2878 <div class="section" id="id350">
2879 <h2>Features added</h2>
2881 <li>The <tt class="docutils literal">ElementMaker</tt> in <tt class="docutils literal">lxml.builder</tt> now accepts the keyword arguments
2882 <tt class="docutils literal">namespace</tt> and <tt class="docutils literal">nsmap</tt> to set a namespace and nsmap for the Elements it
2884 <li>The <tt class="docutils literal">docinfo</tt> on ElementTree objects has new properties <tt class="docutils literal">internalDTD</tt>
2885 and <tt class="docutils literal">externalDTD</tt> that return a DTD object for the internal or external
2886 subset of the document respectively.</li>
2887 <li>Serialising an ElementTree now includes any internal DTD subsets that are
2888 part of the document, as well as comments and PIs that are siblings of the
2892 <div class="section" id="id351">
2895 <li>Parsing with the <tt class="docutils literal">no_network</tt> option could fail</li>
2898 <div class="section" id="id352">
2899 <h2>Other changes</h2>
2901 <li>lxml now raises a TagNameWarning about tag names containing ':' instead of
2902 an Error as 1.3.3 did. The reason is that a number of projects currently
2903 misuse the previous lack of tag name validation to generate namespace
2904 prefixes without declaring namespaces. Apart from the danger of generating
2905 broken XML this way, it also breaks most of the namespace-aware tools in
2906 XML, including XPath, XSLT and validation. lxml 1.3.x will continue to
2907 support this bug with a Warning, while lxml 2.0 will be strict about
2908 well-formed tag names (not only regarding ':').</li>
2909 <li>Serialising an Element no longer includes its comment and PI siblings (only
2910 ElementTree serialisation includes them).</li>
2914 <div class="section" id="id353">
2915 <h1>1.3.3 (2007-07-26)</h1>
2916 <div class="section" id="id354">
2917 <h2>Features added</h2>
2919 <li>ElementTree compatible parser <tt class="docutils literal">ETCompatXMLParser</tt> strips processing
2920 instructions and comments while parsing XML</li>
2921 <li>Parsers now support stripping PIs (keyword argument 'remove_pis')</li>
2922 <li><tt class="docutils literal">etree.fromstring()</tt> now supports parsing both HTML and XML, depending on
2923 the parser you pass.</li>
2924 <li>Support <tt class="docutils literal">base_url</tt> keyword argument in <tt class="docutils literal">HTML()</tt> and <tt class="docutils literal">XML()</tt></li>
2927 <div class="section" id="id355">
2930 <li>Parsing from Python Unicode strings failed on some platforms</li>
2931 <li><tt class="docutils literal">Element()</tt> did not raise an exception on tag names containing ':'</li>
2932 <li><tt class="docutils literal">Element.getiterator(tag)</tt> did not accept <tt class="docutils literal">Comment</tt> and
2933 <tt class="docutils literal">ProcessingInstruction</tt> as tags. It also accepts <tt class="docutils literal">Element</tt> now.</li>
2937 <div class="section" id="id356">
2938 <h1>1.3.2 (2007-07-03)</h1>
2939 <div class="section" id="id357">
2940 <h2>Features added</h2>
2942 <div class="section" id="id358">
2945 <li>"deallocating None" crash bug</li>
2949 <div class="section" id="id359">
2950 <h1>1.3.1 (2007-07-02)</h1>
2951 <div class="section" id="id360">
2952 <h2>Features added</h2>
2954 <li>objectify.DataElement now supports setting values from existing data
2955 elements (not just plain Python types) and reuses defined namespaces etc.</li>
2956 <li>E-factory support for lxml.objectify (<tt class="docutils literal">objectify.E</tt>)</li>
2959 <div class="section" id="id361">
2962 <li>Better way to prevent crashes in Element proxy cleanup code</li>
2963 <li>objectify.DataElement didn't set up None value correctly</li>
2964 <li>objectify.DataElement didn't check the value against the provided type hints</li>
2965 <li>Reference-counting bug in <tt class="docutils literal">Element.attrib.pop()</tt></li>
2969 <div class="section" id="id362">
2970 <h1>1.3 (2007-06-24)</h1>
2971 <div class="section" id="id363">
2972 <h2>Features added</h2>
2974 <li>Module <tt class="docutils literal">lxml.pyclasslookup</tt> module implements an Element class lookup
2975 scheme that can access the entire tree in read-only mode to help determining
2976 a suitable Element class</li>
2977 <li>Parsers take a <tt class="docutils literal">remove_comments</tt> keyword argument that skips over comments</li>
2978 <li><tt class="docutils literal">parse()</tt> function in <tt class="docutils literal">objectify</tt>, corresponding to <tt class="docutils literal">XML()</tt> etc.</li>
2979 <li><tt class="docutils literal">Element.addnext(el)</tt> and <tt class="docutils literal">Element.addprevious(el)</tt> methods to support
2980 adding processing instructions and comments around the root node</li>
2981 <li><tt class="docutils literal">Element.attrib</tt> was missing <tt class="docutils literal">clear()</tt> and <tt class="docutils literal">pop()</tt> methods</li>
2982 <li>Extended type annotation in objectify: cleaner annotation namespace setup
2983 plus new <tt class="docutils literal">deannotate()</tt> function</li>
2984 <li>Support for custom Element class instantiation in lxml.sax: passing a
2985 <tt class="docutils literal">makeelement</tt> function to the ElementTreeContentHandler will reuse the
2986 lookup context of that function</li>
2987 <li>'.' represents empty ObjectPath (identity)</li>
2988 <li><tt class="docutils literal">Element.values()</tt> to accompany the existing <tt class="docutils literal">.keys()</tt> and <tt class="docutils literal">.items()</tt></li>
2989 <li><tt class="docutils literal">collectAttributes()</tt> C-function to build a list of attribute
2990 keys/values/items for a libxml2 node</li>
2991 <li><tt class="docutils literal">DTD</tt> validator class (like <tt class="docutils literal">RelaxNG</tt> and <tt class="docutils literal">XMLSchema</tt>)</li>
2992 <li>HTML generator helpers by Fredrik Lundh in <tt class="docutils literal">lxml.htmlbuilder</tt></li>
2993 <li><tt class="docutils literal">ElementMaker</tt> XML generator by Fredrik Lundh in <tt class="docutils literal">lxml.builder.E</tt></li>
2994 <li>Support for pickling <tt class="docutils literal">objectify.ObjectifiedElement</tt> objects to XML</li>
2995 <li><tt class="docutils literal">update()</tt> method on Element.attrib</li>
2996 <li>Optimised replacement for libxml2's _xmlReconsiliateNs(). This allows lxml
2997 a better handling of namespaces when moving elements between documents.</li>
3000 <div class="section" id="id364">
3003 <li>Removing Elements from a tree could make them lose their namespace
3005 <li><tt class="docutils literal">ElementInclude</tt> didn't honour base URL of original document</li>
3006 <li>Replacing the children slice of an Element would cut off the tails of the
3007 original children</li>
3008 <li><tt class="docutils literal">Element.getiterator(tag)</tt> did not accept <tt class="docutils literal">Comment</tt> and
3009 <tt class="docutils literal">ProcessingInstruction</tt> as tags</li>
3010 <li>API functions now check incoming strings for XML conformity. Zero bytes or
3011 low ASCII characters are no longer accepted (AssertionError).</li>
3012 <li>XSLT parsing failed to pass resolver context on to imported documents</li>
3013 <li>passing '' as namespace prefix in nsmap could be passed through to libxml2</li>
3014 <li>Objectify couldn't handle prefixed XSD type names in <tt class="docutils literal">xsi:type</tt></li>
3015 <li>More ET compatible behaviour when writing out XML declarations or not</li>
3016 <li>More robust error handling in <tt class="docutils literal">iterparse()</tt></li>
3017 <li>Documents lost their top-level PIs and comments on serialisation</li>
3018 <li>lxml.sax failed on comments and PIs. Comments are now properly ignored and
3019 PIs are copied.</li>
3020 <li>Possible memory leaks in namespace handling when moving elements between
3024 <div class="section" id="id365">
3025 <h2>Other changes</h2>
3027 <li>major restructuring in the documentation</li>
3031 <div class="section" id="id366">
3032 <h1>1.2.1 (2007-02-27)</h1>
3033 <div class="section" id="id367">
3036 <li>Build fixes for MS compiler</li>
3037 <li>Item assignments to special names like <tt class="docutils literal"><span class="pre">element["text"]</span></tt> failed</li>
3038 <li>Renamed ObjectifiedDataElement.__setText() to _setText() to make it easier
3040 <li>The pattern for attribute names in ObjectPath was too restrictive</li>
3044 <div class="section" id="id368">
3045 <h1>1.2 (2007-02-20)</h1>
3046 <div class="section" id="id369">
3047 <h2>Features added</h2>
3049 <li>Rich comparison of QName objects</li>
3050 <li>Support for regular expressions in benchmark selection</li>
3051 <li>get/set emulation (not .attrib!) for attributes on processing instructions</li>
3052 <li>ElementInclude Python module for ElementTree compatible XInclude processing
3053 that honours custom resolvers registered with the source document</li>
3054 <li>ElementTree.parser property holds the parser used to parse the document</li>
3055 <li>setup.py has been refactored for greater readability and flexibility</li>
3056 <li>--rpath flag to setup.py to induce automatic linking-in of dynamic library
3057 runtime search paths has been renamed to --auto-rpath. This makes it
3058 possible to pass an --rpath directly to distutils; previously this was being
3062 <div class="section" id="id370">
3065 <li>Element instantiation now uses locks to prevent race conditions with threads</li>
3066 <li>ElementTree.write() did not raise an exception when the file was not writable</li>
3067 <li>Error handling could crash under Python <= 2.4.1 - fixed by disabling thread
3068 support in these environments</li>
3069 <li>Element.find*() did not accept QName objects as path</li>
3072 <div class="section" id="id371">
3073 <h2>Other changes</h2>
3075 <li>code cleanup: redundant _NodeBase super class merged into _Element class
3076 Note: although the impact should be zero in most cases, this change breaks
3077 the compatibility of the public C-API</li>
3081 <div class="section" id="id372">
3082 <h1>1.1.2 (2006-10-30)</h1>
3083 <div class="section" id="id373">
3084 <h2>Features added</h2>
3086 <li>Data elements in objectify support repr(), which is now used by dump()</li>
3087 <li>Source distribution now ships with a patched Pyrex</li>
3088 <li>New C-API function makeElement() to create new elements with text,
3089 tail, attributes and namespaces</li>
3090 <li>Reuse original parser flags for XInclude</li>
3091 <li>Simplified support for handling XSLT processing instructions</li>
3094 <div class="section" id="id374">
3097 <li>Parser resources were not freed before the next parser run</li>
3098 <li>Open files and XML strings returned by Python resolvers were not
3100 <li>Crash in the IDDict returned by XMLDTDID</li>
3101 <li>Copying Comments and ProcessingInstructions failed</li>
3102 <li>Memory leak for external URLs in _XSLTProcessingInstruction.parseXSL()</li>
3103 <li>Memory leak when garbage collecting tailed root elements</li>
3104 <li>HTML script/style content was not propagated to .text</li>
3105 <li>Show text xincluded between text nodes correctly in .text and .tail</li>
3106 <li>'integer * objectify.StringElement' operation was not supported</li>
3110 <div class="section" id="id375">
3111 <h1>1.1.1 (2006-09-21)</h1>
3112 <div class="section" id="id376">
3113 <h2>Features added</h2>
3115 <li>XSLT profiling support (<tt class="docutils literal">profile_run</tt> keyword)</li>
3116 <li>countchildren() method on objectify.ObjectifiedElement</li>
3117 <li>Support custom elements for tree nodes in lxml.objectify</li>
3120 <div class="section" id="id377">
3123 <li>lxml.objectify failed to support long data values (e.g., "123L")</li>
3124 <li>Error messages from XSLT did not reach <tt class="docutils literal">XSLT.error_log</tt></li>
3125 <li>Factories objectify.Element() and objectify.DataElement() were missing
3126 <tt class="docutils literal">attrib</tt> and <tt class="docutils literal">nsmap</tt> keyword arguments</li>
3127 <li>Changing the default parser in lxml.objectify did not update the factories
3128 Element() and DataElement()</li>
3129 <li>Let lxml.objectify.Element() always generate tree elements (not data
3131 <li>Build under Windows failed ('0' bug in patched Pyrex version)</li>
3135 <div class="section" id="id378">
3136 <h1>1.1 (2006-09-13)</h1>
3137 <div class="section" id="id379">
3138 <h2>Features added</h2>
3140 <li>Comments and processing instructions return '<!-- comment -->' and
3141 '<?pi-target content?>' for repr()</li>
3142 <li>Parsers are now the preferred (and default) place where element class lookup
3143 schemes should be registered. Namespace lookup is no longer supported by
3145 <li>Support for Python 2.5 beta</li>
3146 <li>Unlock the GIL for deep copying documents and for XPath()</li>
3147 <li>New <tt class="docutils literal">compact</tt> keyword argument for parsing read-only documents</li>
3148 <li>Support for parser options in iterparse()</li>
3149 <li>The <tt class="docutils literal">namespace</tt> axis is supported in XPath and returns (prefix, URI)
3151 <li>The XPath expression "/" now returns an empty list instead of raising an
3153 <li>XML-Object API on top of lxml (lxml.objectify)</li>
3154 <li>Customizable Element class lookup:<ul>
3155 <li>different pre-implemented lookup mechanisms</li>
3156 <li>support for externally provided lookup functions</li>
3159 <li>Support for processing instructions (ET-like, not compatible)</li>
3160 <li>Public C-level API for independent extension modules</li>
3161 <li>Module level <tt class="docutils literal">iterwalk()</tt> function as 'iterparse' for trees</li>
3162 <li>Module level <tt class="docutils literal">iterparse()</tt> function similar to ElementTree (see
3163 documentation for differences)</li>
3164 <li>Element.nsmap property returns a mapping of all namespace prefixes known at
3165 the Element to their namespace URI</li>
3166 <li>Reentrant threading support in RelaxNG, XMLSchema and XSLT</li>
3167 <li>Threading support in parsers and serializers:<ul>
3168 <li>All in-memory operations (tostring, parse(StringIO), etc.) free the GIL</li>
3169 <li>File operations (on file names) free the GIL</li>
3170 <li>Reading from file-like objects frees the GIL and reacquires it for reading</li>
3171 <li>Serialisation to file-like objects is single-threaded (high lock overhead)</li>
3174 <li>Element iteration over XPath axes:<ul>
3175 <li>Element.iterdescendants() iterates over the descendants of an element</li>
3176 <li>Element.iterancestors() iterates over the ancestors of an element (from
3177 parent to parent)</li>
3178 <li>Element.itersiblings() iterates over either the following or preceding
3179 siblings of an element</li>
3180 <li>Element.iterchildren() iterates over the children of an element in either
3182 <li>All iterators support the <tt class="docutils literal">tag</tt> keyword argument to restrict the
3183 generated elements</li>
3186 <li>Element.getnext() and Element.getprevious() return the direct siblings of an
3190 <div class="section" id="id380">
3193 <li>filenames with local 8-bit encoding were not supported</li>
3194 <li>1.1beta did not compile under Python 2.3</li>
3195 <li>ignore unknown 'pyval' attribute values in objectify</li>
3196 <li>objectify.ObjectifiedElement.addattr() failed to accept Elements and Lists</li>
3197 <li>objectify.ObjectPath.setattr() failed to accept Elements and Lists</li>
3198 <li>XPathSyntaxError now inherits from XPathError</li>
3199 <li>Threading race conditions in RelaxNG and XMLSchema</li>
3200 <li>Crash when mixing elements from XSLT results into other trees, concurrent
3201 XSLT is only allowed when the stylesheet was parsed in the main thread</li>
3202 <li>The EXSLT <tt class="docutils literal">regexp:match</tt> function now works as defined (except for some
3203 differences in the regular expression syntax)</li>
3204 <li>Setting element.text to '' returned None on request, not the empty string</li>
3205 <li><tt class="docutils literal">iterparse()</tt> could crash on long XML files</li>
3206 <li>Creating documents no longer copies the parser for later URL resolving. For
3207 performance reasons, only a reference is kept. Resolver updates on the
3208 parser will now be reflected by documents that were parsed before the
3209 change. Although this should rarely become visible, it is a behavioral
3210 change from 1.0.</li>
3214 <div class="section" id="id381">
3215 <h1>1.0.4 (2006-09-09)</h1>
3216 <div class="section" id="id382">
3217 <h2>Features added</h2>
3219 <li>List-like <tt class="docutils literal">Element.extend()</tt> method</li>
3222 <div class="section" id="id383">
3225 <li>Crash in tail handling in <tt class="docutils literal">Element.replace()</tt></li>
3229 <div class="section" id="id384">
3230 <h1>1.0.3 (2006-08-08)</h1>
3231 <div class="section" id="id385">
3232 <h2>Features added</h2>
3234 <li>Element.replace(old, new) method to replace a subelement by another one</li>
3237 <div class="section" id="id386">
3240 <li>Crash when mixing elements from XSLT results into other trees</li>
3241 <li>Copying/deepcopying did not work for ElementTree objects</li>
3242 <li>Setting an attribute to a non-string value did not raise an exception</li>
3243 <li>Element.remove() deleted the tail text from the removed Element</li>
3247 <div class="section" id="id387">
3248 <h1>1.0.2 (2006-06-27)</h1>
3249 <div class="section" id="id388">
3250 <h2>Features added</h2>
3252 <li>Support for setting a custom default Element class as opposed to namespace
3253 specific classes (which still override the default class)</li>
3256 <div class="section" id="id389">
3259 <li>Rare exceptions in Python list functions were not handled</li>
3260 <li>Parsing accepted unicode strings with XML encoding declaration in certain
3262 <li>Parsing 8-bit encoded strings from StringIO objects raised an exception</li>
3263 <li>Module function <tt class="docutils literal">initThread()</tt> was removed - useless (and never worked)</li>
3264 <li>XSLT and parser exception messages include the error line number</li>
3268 <div class="section" id="id390">
3269 <h1>1.0.1 (2006-06-09)</h1>
3270 <div class="section" id="id391">
3271 <h2>Features added</h2>
3273 <li>Repeated calls to Element.attrib now efficiently return the same instance</li>
3276 <div class="section" id="id392">
3279 <li>Document deallocation could crash in certain garbage collection scenarios</li>
3280 <li>Extension function calls in XSLT variable declarations could break the
3281 stylesheet and crash on repeated calls</li>
3282 <li>Deep copying Elements could lose namespaces declared in parents</li>
3283 <li>Deep copying Elements did not copy tail</li>
3284 <li>Parsing file(-like) objects failed to load external entities</li>
3285 <li>Parsing 8-bit strings from file(-like) objects raised an exception</li>
3286 <li>xsl:include failed when the stylesheet was parsed from a file-like object</li>
3287 <li>lxml.sax.ElementTreeProducer did not call startDocument() / endDocument()</li>
3288 <li>MSVC compiler complained about long strings (supports only 2048 bytes)</li>
3292 <div class="section" id="id393">
3293 <h1>1.0 (2006-06-01)</h1>
3294 <div class="section" id="id394">
3295 <h2>Features added</h2>
3297 <li>Element.getiterator() and the findall() methods support finding arbitrary
3298 elements from a namespace (pattern <tt class="docutils literal">{namespace}*</tt>)</li>
3299 <li>Another speedup in tree iteration code</li>
3300 <li>General speedup of Python Element object creation and deallocation</li>
3301 <li>Writing C14N no longer serializes in memory (reduced memory footprint)</li>
3302 <li>PyErrorLog for error logging through the Python <tt class="docutils literal">logging</tt> module</li>
3303 <li><tt class="docutils literal">Element.getroottree()</tt> returns an ElementTree for the root node of the
3304 document that contains the element.</li>
3305 <li>ElementTree.getpath(element) returns a simple, absolute XPath expression to
3306 find the element in the tree structure</li>
3307 <li>Error logs have a <tt class="docutils literal">last_error</tt> attribute for convenience</li>
3308 <li>Comment texts can be changed through the API</li>
3309 <li>Formatted output via <tt class="docutils literal">pretty_print</tt> keyword in serialization functions</li>
3310 <li>XSLT can block access to file system and network via <tt class="docutils literal">XSLTAccessControl</tt></li>
3311 <li>ElementTree.write() no longer serializes in memory (reduced memory
3313 <li>Speedup of Element.findall(tag) and Element.getiterator(tag)</li>
3314 <li>Support for writing the XML representation of Elements and ElementTrees to
3315 Python unicode strings via <tt class="docutils literal">etree.tounicode()</tt></li>
3316 <li>Support for writing XSLT results to Python unicode strings via <tt class="docutils literal">unicode()</tt></li>
3317 <li>Parsing a unicode string no longer copies the string (reduced memory
3319 <li>Parsing file-like objects reads chunks rather than the whole file (reduced
3320 memory footprint)</li>
3321 <li>Parsing StringIO objects from the start avoids copying the string (reduced
3322 memory footprint)</li>
3323 <li>Read-only 'docinfo' attribute in ElementTree class holds DOCTYPE
3324 information, original encoding and XML version as seen by the parser</li>
3325 <li>etree module can be compiled without libxslt by commenting out the line
3326 <tt class="docutils literal">include "xslt.pxi"</tt> near the end of the etree.pyx source file</li>
3327 <li>Better error messages in parser exceptions</li>
3328 <li>Error reporting also works in XSLT</li>
3329 <li>Support for custom document loaders (URI resolvers) in parsers and XSLT,
3330 resolvers are registered at parser level</li>
3331 <li>Implementation of exslt:regexp for XSLT based on the Python 're' module,
3332 enabled by default, can be switched off with 'regexp=False' keyword argument</li>
3333 <li>Support for exslt extensions (libexslt) and libxslt extra functions
3334 (node-set, document, write, output)</li>
3335 <li>Substantial speedup in XPath.evaluate()</li>
3336 <li>HTMLParser for parsing (broken) HTML</li>
3337 <li>XMLDTDID function parses XML into tuple (root node, ID dict) based on xml:id
3338 implementation of libxml2 (as opposed to ET compatible XMLID)</li>
3341 <div class="section" id="id395">
3344 <li>Memory leak in Element.__setitem__</li>
3345 <li>Memory leak in Element.attrib.items() and Element.attrib.values()</li>
3346 <li>Memory leak in XPath extension functions</li>
3347 <li>Memory leak in unicode related setup code</li>
3348 <li>Element now raises ValueError on empty tag names</li>
3349 <li>Namespace fixing after moving elements between documents could fail if the
3350 source document was freed too early</li>
3351 <li>Setting namespace-less tag names on namespaced elements ('{ns}t' -> 't')
3352 didn't reset the namespace</li>
3353 <li>Unknown constants from newer libxml2 versions could raise exceptions in the
3355 <li>lxml.etree compiles much faster</li>
3356 <li>On libxml2 <= 2.6.22, parsing strings with encoding declaration could fail
3357 in certain cases</li>
3358 <li>Document reference in ElementTree objects was not updated when the root
3359 element was moved to a different document</li>
3360 <li>Running absolute XPath expressions on an Element now evaluates against the
3362 <li>Evaluating absolute XPath expressions (<tt class="docutils literal">/*</tt>) on an ElementTree could fail</li>
3363 <li>Crashes when calling XSLT, RelaxNG, etc. with uninitialized ElementTree
3365 <li>Removed public function <tt class="docutils literal">initThreadLogging()</tt>, replaced by more general
3366 <tt class="docutils literal">initThread()</tt> which fixes a number of setup problems in threads</li>
3367 <li>Memory leak when using iconv encoders in tostring/write</li>
3368 <li>Deep copying Elements and ElementTrees maintains the document information</li>
3369 <li>Serialization functions raise LookupError for unknown encodings</li>
3370 <li>Memory deallocation crash resulting from deep copying elements</li>
3371 <li>Some ElementTree methods could crash if the root node was not initialized
3372 (neither file nor element passed to the constructor)</li>
3373 <li>Element/SubElement failed to set attribute namespaces from passed <tt class="docutils literal">attrib</tt>
3375 <li><tt class="docutils literal">tostring()</tt> adds an XML declaration for non-ASCII encodings</li>
3376 <li><tt class="docutils literal">tostring()</tt> failed to serialize encodings that contain 0-bytes</li>
3377 <li>ElementTree.xpath() and XPathDocumentEvaluator were not using the
3378 ElementTree root node as reference point</li>
3379 <li>Calling <tt class="docutils literal"><span class="pre">document('')</span></tt> in XSLT failed to return the stylesheet</li>
3383 <div class="section" id="id396">
3384 <h1>0.9.2 (2006-05-10)</h1>
3385 <div class="section" id="id397">
3386 <h2>Features added</h2>
3388 <li>Speedup for Element.makeelement(): the new element reuses the original
3389 libxml2 document instead of creating a new empty one</li>
3390 <li>Speedup for reversed() iteration over element children (Py2.4+ only)</li>
3391 <li>ElementTree compatible QName class</li>
3392 <li>RelaxNG and XMLSchema accept any Element, not only ElementTrees</li>
3395 <div class="section" id="id398">
3398 <li>str(xslt_result) was broken for XSLT output other than UTF-8</li>
3399 <li>Memory leak if write_c14n fails to write the file after conversion</li>
3400 <li>Crash in XMLSchema and RelaxNG when passing non-schema documents</li>
3401 <li>Memory leak in RelaxNG() when RelaxNGParseError is raised</li>
3405 <div class="section" id="id399">
3406 <h1>0.9.1 (2006-03-30)</h1>
3407 <div class="section" id="id400">
3408 <h2>Features added</h2>
3410 <li>lxml.sax.ElementTreeContentHandler checks closing elements and raises
3411 SaxError on mismatch</li>
3412 <li>lxml.sax.ElementTreeContentHandler supports namespace-less SAX events
3413 (startElement, endElement) and defaults to empty attributes (keyword
3415 <li>Speedup for repeatedly accessing element tag names</li>
3416 <li>Minor API performance improvements</li>
3419 <div class="section" id="id401">
3422 <li>Memory deallocation bug when using XSLT output method "html"</li>
3423 <li>sax.py was handling UTF-8 encoded tag names where it shouldn't</li>
3424 <li>lxml.tests package will no longer be installed (is still in source tar)</li>
3428 <div class="section" id="id402">
3429 <h1>0.9 (2006-03-20)</h1>
3430 <div class="section" id="id403">
3431 <h2>Features added</h2>
3433 <li>Error logging API for libxml2 error messages</li>
3434 <li>Various performance improvements</li>
3435 <li>Benchmark script for lxml, ElementTree and cElementTree</li>
3436 <li>Support for registering extension functions through new FunctionNamespace
3437 class (see doc/extensions.txt)</li>
3438 <li>ETXPath class for XPath expressions in ElementTree notation ('//{ns}tag')</li>
3439 <li>Support for variables in XPath expressions (also in XPath class)</li>
3440 <li>XPath class for compiled XPath expressions</li>
3441 <li>XMLID module level function (ElementTree compatible)</li>
3442 <li>XMLParser API for customized libxml2 parser configuration</li>
3443 <li>Support for custom Element classes through new Namespace API (see
3444 doc/namespace_extensions.txt)</li>
3445 <li>Common exception base class LxmlError for module exceptions</li>
3446 <li>real iterator support in iter(Element), Element.getiterator()</li>
3447 <li>XSLT objects are callable, result trees support str()</li>
3448 <li>Added MANIFEST.in for easier creation of RPM files.</li>
3449 <li>'getparent' method on elements allows navigation to an element's
3450 parent element.</li>
3451 <li>Python core compatible SAX tree builder and SAX event generator. See
3452 doc/sax.txt for more information.</li>
3455 <div class="section" id="id404">
3458 <li>Segfaults and memory leaks in various API functions of Element</li>
3459 <li>Segfault in XSLT.tostring()</li>
3460 <li>ElementTree objects no longer interfere, Elements can be root of different
3461 ElementTrees at the same time</li>
3462 <li>document('') works in XSLT documents read from files (in-memory documents
3463 cannot support this due to libxslt deficiencies)</li>
3467 <div class="section" id="id405">
3468 <h1>0.8 (2005-11-03)</h1>
3469 <div class="section" id="id406">
3470 <h2>Features added</h2>
3472 <li>Support for copy.deepcopy() on elements. copy.copy() works also, but
3473 does the same thing, and does <em>not</em> create a shallow copy, as that
3474 makes no sense in the context of libxml2 trees. This means a
3475 potential incompatibility with ElementTree, but there's more chance
3476 that it works than if copy.copy() isn't supported at all.</li>
3477 <li>Increased compatibility with (c)ElementTree; .parse() on ElementTree is
3478 supported and parsing of gzipped XML files works.</li>
3479 <li>implemented index() on elements, allowing one to find the index of a
3483 <div class="section" id="id407">
3486 <li>Use xslt-config instead of xml2-config to find out libxml2
3487 directories to take into account a case where libxslt is installed
3488 in a different directory than libxslt.</li>
3489 <li>Eliminate crash condition in iteration when text nodes are changed.</li>
3490 <li>Passing 'None' to tostring() does not result in a segfault anymore,
3491 but an AssertionError.</li>
3492 <li>Some test fixes for Windows.</li>
3493 <li>Raise XMLSyntaxError and XPathSyntaxError instead of plain python
3494 syntax errors. This should be less confusing.</li>
3495 <li>Fixed error with uncaught exception in Pyrex code.</li>
3496 <li>Calling lxml.etree.fromstring('') throws XMLSyntaxError instead of a
3498 <li>has_key() works on attrib. 'in' tests also work correctly on attrib.</li>
3499 <li>INSTALL.txt was saying 2.2.16 instead of 2.6.16 as a supported
3500 libxml2 version, as it should.</li>
3501 <li>Passing a UTF-8 encoded string to the XML() function would fail;
3506 <div class="section" id="id408">
3507 <h1>0.7 (2005-06-15)</h1>
3508 <div class="section" id="id409">
3509 <h2>Features added</h2>
3511 <li>parameters (XPath expressions) can be passed to XSLT using keyword
3513 <li>Simple XInclude support. Calling the xinclude() method on a tree
3514 will process any XInclude statements in the document.</li>
3515 <li>XMLSchema support. Use the XMLSchema class or the convenience
3516 xmlschema() method on a tree to do XML Schema (XSD) validation.</li>
3517 <li>Added convenience xslt() method on tree. This is less efficient
3518 than the XSLT object, but makes it easier to write quick code.</li>
3519 <li>Added convenience relaxng() method on tree. This is less efficient
3520 than the RelaxNG object, but makes it easier to write quick code.</li>
3521 <li>Make it possible to use XPathEvaluator with elements as well. The
3522 XPathEvaluator in this case will retain the element so multiple
3523 XPath queries can be made against one element efficiently. This
3524 replaces the second argument to the .evaluate() method that existed
3526 <li>Allow registerNamespace() to be called on an XPathEvaluator, after
3527 creation, to add additional namespaces. Also allow registerNamespaces(),
3528 which does the same for a namespace dictionary.</li>
3529 <li>Add 'prefix' attribute to element to be able to read prefix information.
3530 This is entirely read-only.</li>
3531 <li>It is possible to supply an extra nsmap keyword parameter to
3532 the Element() and SubElement() constructors, which supplies a
3533 prefix to namespace URI mapping. This will create namespace
3534 prefix declarations on these elements and these prefixes will show up
3535 in XML serialization.</li>
3538 <div class="section" id="id410">
3541 <li>Killed yet another memory management related bug: trees created
3542 using newDoc would not get a libxml2-level dictionary, which caused
3543 problems when deallocating these documents later if they contained a
3544 node that came from a document with a dictionary.</li>
3545 <li>Moving namespaced elements between documents was problematic as
3546 references to the original document would remain. This has been fixed
3547 by applying xmlReconciliateNs() after each move operation.</li>
3548 <li>Can pass None to 'dump()' without segfaults.</li>
3549 <li>tostring() works properly for non-root elements as well.</li>
3550 <li>Cleaned out the tostring() method so it should handle encoding
3552 <li>Cleaned out the ElementTree.write() method so it should handle encoding
3553 correctly. Writing directly to a file should also be faster, as there is no
3554 need to go through a Python string in that case. Made sure the test cases
3555 test both serializing to StringIO as well as serializing to a real file.</li>
3559 <div class="section" id="id411">
3560 <h1>0.6 (2005-05-14)</h1>
3561 <div class="section" id="id412">
3562 <h2>Features added</h2>
3564 <li>Changed setup.py so that library_dirs is also guessed. This should
3565 help with compilation on the Mac OS X platform, where otherwise the
3566 wrong library (shipping with the OS) could be picked up.</li>
3567 <li>Tweaked setup.py so that it picks up the version from version.txt.</li>
3570 <div class="section" id="id413">
3573 <li>Do the right thing when handling namespaced attributes.</li>
3574 <li>fix bug where tostring() moved nodes into new documents. tostring()
3575 had very nasty side-effects before this fix, sorry!</li>
3579 <div class="section" id="id414">
3580 <h1>0.5.1 (2005-04-09)</h1>
3582 <li>Python 2.2 compatibility fixes.</li>
3583 <li>unicode fixes in Element() and Comment() as well as XML(); unicode
3584 input wasn't properly being UTF-8 encoded.</li>
3587 <div class="section" id="id415">
3588 <h1>0.5 (2005-04-08)</h1>
3589 <p>Initial public release.</p>
3592 <div class="footer">
3593 <hr class="footer" />
3594 Generated on: 2020-01-29.