Debian Codegraph @

CHANGES.txt

raw
1 ==============
2 lxml changelog
3 ==============
4
5 6.1.3 (2026-09-02)
6 ==================
7
8 Bugs fixed
9 ----------
10
11 * LP#2165901: External parameter entity parsing was allowed by default
12 (with ``resolve_entities="internal"``).
13 Issue found by Tomer Fichman.
14
15
16 6.1.2 (2026-08-18)
17 ==================
18
19 Bugs fixed
20 ----------
21
22 * GH#526: Some build files were missing in the sdist.
23 Patch by Nicola Soranzo.
24
25 * Some minor corrections for error handling cases.
26
27 Other changes
28 -------------
29
30 * Built with Cython 3.2.9.
31
32
33 6.1.1 (2026-05-18)
34 ==================
35
36 Bugs fixed
37 ----------
38
39 * The known link attributes in ``lxml.html.defs.link_attrs`` were missing ``xlink:href``,
40 which can be used for URL bypass attacks in embedded SVG/MathML/etc. content.
41 https://github.com/fedora-python/lxml_html_clean/security/advisories/GHSA-4jhm-jv67-739f
42
43 * The Linux wheels use a patched libxslt 1.1.43, fixing CVE-2025-7424 and CVE-2025-11731.
44
45 * The Windows wheels use libxslt 1.1.45, fixing CVE-2025-7424 and CVE-2025-11731.
46
47
48 6.1.0 (2026-04-17)
49 ==================
50
51 This release fixes a possible external entity injection (XXE) vulnerability in
52 ``iterparse()`` and the ``ETCompatXMLParser``.
53
54 Features added
55 --------------
56
57 * GH#486: The HTML ARIA accessibility attributes were added to the set of safe attributes
58 in ``lxml.html.defs``. This allows ``lxml_html_clean`` to pass them through.
59 Patch by oomsveta.
60
61 * The default chunk size for reading from file-likes in ``iterparse()`` is now configurable
62 with a new ``chunk_size`` argument.
63
64 Bugs fixed
65 ----------
66
67 * LP#2146291: The ``resolve_entities`` option was still set to ``True`` for
68 ``iterparse`` and ``ETCompatXMLParser``, allowing for external entity injection (XXE)
69 when using these parsers without setting this option explicitly.
70 The default was now changed to ``'internal'`` only (as for the normal XML and HTML parsers
71 since lxml 5.0).
72 Issue found by Sihao Qiu as CVE-2026-41066.
73
74
75 6.0.4 (2026-04-12)
76 ==================
77
78 Bugs fixed
79 ----------
80
81 * LP#2148019: Spurious MemoryError during namespace cleanup.
82
83
84 6.0.3 (2026-04-09)
85 ==================
86
87 Bugs fixed
88 ----------
89
90 * Several out of memory error cases now raise ``MemoryError`` that were not handled before.
91
92 * Slicing with large step values (outside of ``+/- sys.maxsize``) could trigger undefined C behaviour.
93
94 * LP#2125399: Some failing tests were fixed or disabled in PyPy.
95
96 * LP#2138421: Memory leak in error cases when setting the ``public_id`` or ``system_url`` of a document.
97
98 * Memory leak in case of a memory allocation failure when copying document subtrees.
99
100 * When mapping an XPath result to Python failed, the result memory could leak.
101
102 * When preparing an XSLT transform failed, the XSLT parameter memory could leak.
103
104 Other changes
105 -------------
106
107 * Built using Cython 3.2.4.
108
109 * Binary wheels use zlib 1.3.2.
110
111
112 6.0.2 (2025-09-21)
113 ==================
114
115 Bugs fixed
116 ----------
117
118 * LP#2125278: Compilation with libxml2 2.15.0 failed.
119 Original patch by Xi Ruoyao.
120
121 * Setting ``decompress=True`` in the parser had no effect in libxml2 2.15.
122
123 * Binary wheels on Linux and macOS use the library version libxml2 2.14.6.
124 See https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.14.6
125
126 * Test failures in libxml2 2.15.0 were fixed.
127
128 Other changes
129 -------------
130
131 * Binary wheels for Py3.9-3.11 on the ``riscv64`` architecture were added.
132
133 * Error constants were updated to match libxml2 2.15.0.
134
135 * Built using Cython 3.1.4.
136
137
138 6.0.1 (2025-08-22)
139 ==================
140
141 Bugs fixed
142 ----------
143
144 * LP#2116333: ``lxml.sax._getNsTag()`` could fail with an exception on malformed input.
145
146 * GH#467: Some test adaptations were made for libxml2 2.15.
147 Patch by Nick Wellnhofer.
148
149 * LP2119510, GH#473: A Python compatibility test was fixed for Python 3.14+.
150 Patch by Lumír Balhar.
151
152 * GH#471: Wheels for "riscv64" on recent Python versions were added.
153 Patch by ffgan.
154
155 * GH#469: The wheel build no longer requires the ``wheel`` package unconditionally.
156 Patch by Miro Hrončok.
157
158 * Binary wheels use the library version libxml2 2.14.5.
159 See https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.14.5
160
161 * Windows binary wheels continue to use a security patched library version libxml2 2.11.9.
162
163
164 6.0.0 (2025-06-26)
165 ==================
166
167 Features added
168 --------------
169
170 * GH#463: ``lxml.html.diff`` is faster and provides structurally better diffs.
171 Original patch by Steven Fernandez.
172
173 * GH#405: The factories ``Element`` and ``ElementTree`` can now be used in type hints.
174
175 * GH#448: Parsing from ``memoryview`` and other buffers is supported to allow zero-copy parsing.
176
177 * GH#437: ``lxml.html.builder`` was missing several HTML5 tag names.
178 Patch by Nick Tarleton.
179
180 * GH#458: ``CDATA`` can now be written into the incremental ``xmlfile()`` writer.
181 Original patch by Lane Shaw.
182
183 * A new parser option ``decompress=False`` was added that controls the automatic
184 input decompression when using libxml2 2.15.0 or later. Disabling this option
185 by default will effectively prevent decompression bombs when handling untrusted
186 input. Code that depends on automatic decompression must enable this option.
187 Note that libxml2 2.15.0 was not released yet, so this option currently has no
188 effect but can already be used.
189
190 * The set of compile time / runtime supported libxml2 feature names is available as
191 ``etree.LIBXML_COMPILED_FEATURES`` and ``etree.LIBXML_FEATURES``.
192 This currently includes
193 ``catalog``, ``ftp``, ``html``, ``http``, ``iconv``, ``icu``,
194 ``lzma``, ``regexp``, ``schematron``, ``xmlschema``, ``xpath``, ``zlib``.
195
196 Bugs fixed
197 ----------
198
199 * GH#353: Predicates in ``.find*()`` could mishandle tag indices if a default namespace is provided.
200 Original patch by Luise K.
201
202 * GH#272: The ``head`` and ``body`` properties of ``lxml.html`` elements failed if no such element
203 was found. They now return ``None`` instead.
204 Original patch by FVolral.
205
206 * Tag names provided by code (API, not data) that are longer than ``INT_MAX``
207 could be truncated or mishandled in other ways.
208
209 * ``.text_content()`` on ``lxml.html`` elements accidentally returned a "smart string"
210 without additional information. It now returns a plain string.
211
212 * LP#2109931: When building lxml with coverage reporting, it now disables the ``sys.monitoring``
213 support due to the lack of support in https://github.com/nedbat/coveragepy/issues/1790
214
215 Other changes
216 -------------
217
218 * Support for Python < 3.8 was removed.
219
220 * Parsing directly from zlib (or lzma) compressed data is now considered an optional
221 feature in lxml. It may get removed from libxml2 at some point for security reasons
222 (compression bombs) and is therefore no longer guaranteed to be available in lxml.
223
224 As of this release, zlib support is still normally available in the binary wheels
225 but may get disabled or removed in later (x.y.0) releases. To test the availability,
226 use ``"zlib" in etree.LIBXML_FEATURES``.
227
228 * The ``Schematron`` class is deprecated and will become non-functional in a future lxml version.
229 The feature will soon be removed from libxml2 and stop being available.
230
231 * GH#438: Wheels include the ``arm7l`` target.
232
233 * GH#465: Windows wheels include the ``arm64`` target.
234 Patch by Finn Womack.
235
236 * Binary wheels use the library versions libxml2 2.14.4 and libxslt 1.1.43.
237 Note that this disables direct HTTP and FTP support for parsing from URLs.
238 Use Python URL request tools instead (which usually also support HTTPS).
239 To test the availability, use ``"http" in etree.LIBXML_FEATURES``.
240
241 * Windows binary wheels use the library versions libxml2 2.11.9, libxslt 1.1.39 and libiconv 1.17.
242 They are now based on VS-2022.
243
244 * Built using Cython 3.1.2.
245
246 * The debug methods ``MemDebug.dump()`` and ``MemDebug.show()`` were removed completely.
247 libxml2 2.13.0 discarded this feature.
248
249
250 5.4.0 (2025-04-22)
251 ==================
252
253 Bugs fixed
254 ----------
255
256 * LP#2107279: Binary wheels use libxml2 2.13.8 and libxslt 1.1.43 to resolve several CVEs.
257 (Binary wheels for Windows continue to use a patched libxml2 2.11.9 and libxslt 1.1.39.)
258 Issue found by Anatoly Katyushin.
259
260
261 5.3.2 (2025-04-05)
262 ==================
263
264 This release resolves CVE-2025-24928 as described in
265 https://gitlab.gnome.org/GNOME/libxml2/-/issues/847
266
267 Bugs fixed
268 ----------
269
270 * Binary wheels use libxml2 2.12.10 and libxslt 1.1.42.
271
272 * Binary wheels for Windows use a patched libxml2 2.11.9 and libxslt 1.1.39.
273
274
275 5.3.1 (2025-02-09)
276 ==================
277
278 Bugs fixed
279 ----------
280
281 * GH#440: Some tests were adapted for libxml2 2.14.0.
282 Patch by Nick Wellnhofer.
283
284 * LP#2097175: ``DTD(external_id="…")`` erroneously required a byte string as ID value.
285
286 * GH#450: ``iterparse()`` internally triggered the `DeprecationWarning`` added in lxml 5.3.0 when parsing HTML.
287
288 Other changes
289 -------------
290
291 * GH#442: Binary wheels for macOS no longer use the linker flag ``-flat_namespace``.
292
293
294 5.3.0 (2024-08-10)
295 ==================
296
297 Features added
298 --------------
299
300 * GH#421: Nested ``CDATA`` sections are no longer rejected but split on output
301 to represent ``]]>`` correctly.
302 Patch by Gertjan Klein.
303
304 Bugs fixed
305 ----------
306
307 * LP#2060160: Attribute values serialised differently in ``xmlfile.element()`` and ``xmlfile.write()``.
308
309 * LP#2058177: The ISO-Schematron implementation could fail on unknown prefixes.
310 Patch by David Lakin.
311
312 Other changes
313 -------------
314
315 * LP#2067707: The ``strip_cdata`` option in ``HTMLParser()`` turned out to be useless and is now deprecated.
316
317 * Binary wheels use the library versions libxml2 2.12.9 and libxslt 1.1.42.
318
319 * Windows binary wheels use the library versions libxml2 2.11.8 and libxslt 1.1.39.
320
321 * Built with Cython 3.0.11.
322
323
324 5.2.2 (2024-05-12)
325 ==================
326
327 Bugs fixed
328 ----------
329
330 * GH#417: The ``test_feed_parser`` test could fail if ``lxml_html_clean`` was not installed.
331 It is now skipped in that case.
332
333 * LP#2059910: The minimum CPU architecture for the Linux x86 binary wheels was set back to
334 "core2", without SSE 4.2.
335
336 * If libxml2 uses iconv, the compile time version is available as `etree.ICONV_COMPILED_VERSION`.
337
338
339 5.2.1 (2024-04-02)
340 ==================
341
342 Bugs fixed
343 ----------
344
345 * LP#2059910: The minimum CPU architecture for the Linux x86 binary wheels was set back to
346 "core2", but with SSE 4.2 enabled.
347
348 * LP#2059977: ``Element.iterfind("//absolute_path")`` failed with a ``SyntaxError``
349 where it should have issued a warning.
350
351 * GH#416: The documentation build was using the non-standard ``which`` command.
352 Patch by Michał Górny.
353
354
355 5.2.0 (2024-03-30)
356 ==================
357
358 Other changes
359 -------------
360
361 * LP#1958539: The ``lxml.html.clean`` implementation suffered from several (only if used)
362 security issues in the past and was now extracted into a separate library:
363
364 https://github.com/fedora-python/lxml_html_clean
365
366 Projects that use lxml without "lxml.html.clean" will not notice any difference,
367 except that they won't have potentially vulnerable code installed.
368 The module is available as an "extra" setuptools dependency "lxml[html_clean]",
369 so that Projects that need "lxml.html.clean" will need to switch their requirements
370 from "lxml" to "lxml[html_clean]", or install the new library themselves.
371
372 * The minimum CPU architecture for the Linux x86 binary wheels was upgraded to
373 "sandybridge" (launched 2011), and glibc 2.28 / gcc 12 (manylinux_2_28) wheels were added.
374
375 * Built with Cython 3.0.10.
376
377
378 5.1.1 (2024-03-28)
379 ==================
380
381 Bugs fixed
382 ----------
383
384 * LP#2048920: ``iterlinks()`` in ``lxml.html`` rejected ``bytes`` input in 5.1.0.
385
386 * High source line numbers from the parser are no longer truncated
387 (up to a C ``long``) when using libxml2 2.11 or later.
388
389 Other changes
390 -------------
391
392 * GH#407: A compatibility test was adapted to recent expat versions.
393 Patch by Miro Hrončok.
394
395 * Binary wheels use the library versions libxml2 2.12.6 and libxslt 1.1.39.
396
397 * Windows binary wheels use the library versions libxml2 2.11.7 and libxslt 1.1.39.
398
399 * Built with Cython 3.0.9.
400
401
402 5.1.0 (2024-01-05)
403 ==================
404
405 Features added
406 --------------
407
408 * Parsing ASCII strings is slightly faster.
409
410 Bugs fixed
411 ----------
412
413 * GH#349: The HTML ``Cleaner()`` interpreted an accidentally provided string parameter
414 for the ``host_whitelist`` as list of characters and silently failed to reject any hosts.
415 Passing a non-collection is now rejected.
416
417 Other changes
418 -------------
419
420 * Support for Python 2.7 and Python versions < 3.6 was removed.
421
422 * The wheel build was migrated to use ``cibuildwheel``.
423 Patch by Primož Godec.
424
425
426 5.0.2 (2024-03-28)
427 ==================
428
429 Other changes
430 -------------
431
432 * GH#407: A compatibility test was adapted to recent expat versions.
433 Patch by Miro Hrončok.
434
435 * Binary wheels use the library versions libxml2 2.12.6 and libxslt 1.1.39.
436
437 * Built with Cython 3.0.9.
438
439
440 5.0.1 (2024-01-05)
441 ==================
442
443 Bugs fixed
444 ----------
445
446 * LP#2046208: Parsing non-BMP Python Unicode strings could fail on macOS.
447
448 * LP#2044225: When incrementally parsing broken HTML, reporting start events on
449 missing structural tags failed and could lead to subsequent exceptions.
450
451 * LP#2045435: Some (not all) issues with stricter C compilers were resolved.
452
453 * The binary wheels in the 5.0.0 release did not validate cleanly (but installed ok).
454
455
456 .. _latest_release:
457
458 5.0.0 (2023-12-29)
459 ==================
460
461 Features added
462 --------------
463
464 * Character escaping in ``C14N2`` serialisation now uses a single pass over the text
465 instead of searching for each unescaped character separately.
466
467 * Early support for Python 3.13a2 was added.
468
469 Bugs fixed
470 ----------
471
472 * LP#1976304: The ``Element.addnext()`` method previously inserted the new element
473 before existing tail text. The tail text of both sibling elements now stays on
474 the respective elements.
475
476 * LP#1980767, GH#379: ``TreeBuilder.close()`` could fail with a ``TypeError`` after
477 parsing incorrect input. Original patch by Enrico Minack.
478
479 * ``Element.itertext(with_tail=False)`` returned the tail text of comments and
480 processing instructions, despite the explicit option.
481
482 * GH#370: A crash with recent libxml2 2.11.x versions was resolved.
483 Patch by Michael Schlenker.
484
485 * A compile problem with recent libxml2 2.12.x versions was resolved.
486
487 * The internal exception handling in C callbacks was improved for Cython 3.0.
488
489 * The exception declarations of ``xmlInputReadCallback``, ``xmlInputCloseCallback``,
490 ``xmlOutputWriteCallback`` and ``xmlOutputCloseCallback`` in ``tree.pxd`` were
491 corrected to prevent running Python code or calling into the C-API with a live
492 exception set.
493
494 * GH#385: The long deprecated ``unittest.m̀akeSuite()`` function is no longer used.
495 Patch by Miro Hrončok.
496
497 * LP#1522052: A file-system specific test is now optional and should no longer fail
498 on systems that don't support it.
499
500 * GH#392: Some tests were adapted for libxml2 2.13.
501 Patch by Nick Wellnhofer.
502
503 * Contains all fixes from lxml 4.9.4.
504
505 Other changes
506 -------------
507
508 * LP#1742885: lxml no longer expands external entities (XXE) by default to prevent
509 the security risk of loading arbitrary files and URLs. If this feature is needed,
510 it can be enabled in a backwards compatible way by using a parser with the option
511 ``resolve_entities=True``. The new default is ``resolve_entities='internal'``.
512
513 * With libxml2 2.10.4 and later (as provided by the lxml 5.0 binary wheels),
514 parsing HTML tags with "prefixes" no longer builds a namespace dictionary
515 in ``nsmap`` but considers the ``prefix:name`` string the actual tag name.
516 With older libxml2 versions, since 2.9.11, the prefix was removed. Before
517 that, the prefix was parsed as XML prefix.
518
519 lxml 5.0 does not try to hide this difference but now changes the ElementPath
520 implementation to let ``element.find("part1:part2")`` search for the tag
521 ``part1:part2`` in documents parsed as HTML, instead of looking only for ``part2``.
522
523 * LP#2024343: The validation of the schema file itself is now optional in the
524 ISO-Schematron implementation. This was done because some lxml distributions
525 discard the RNG validation schema file due to licensing issues. The validation
526 can now always be disabled with ``Schematron(..., validate_schema=False)``.
527 It is enabled by default if available and disabled otherwise. The module
528 constant ``lxml.isoschematron.schematron_schema_valid_supported`` can be used
529 to detect whether schema file validation is available.
530
531 * Some redundant and long deprecated methods were removed:
532 ``parser.setElementClassLookup()``,
533 ``xslt_transform.apply()``,
534 ``xpath.evaluate()``.
535
536 * Some incorrect declarations were removed from ``python.pxd``. In general, this file
537 should not be used by external Cython code. Use the C-API declarations provided by
538 Cython itself instead.
539
540 * Binary wheels use the library versions libxml2 2.12.3 and libxslt 1.1.39.
541
542 * Built with Cython 3.0.7, updated to follow recent changes in Cython 3.1-dev.
543
544
545 4.9.4 (2023-12-19)
546 ==================
547
548 Bugs fixed
549 ----------
550
551 * LP#2046398: Inserting/replacing an ancestor into a node's children could loop indefinitely.
552
553 * LP#1980767, GH#379: ``TreeBuilder.close()`` could fail with a ``TypeError`` after
554 parsing incorrect input. Original patch by Enrico Minack.
555
556 * LP#1522052: A file-system specific test is now optional and should no longer fail
557 on systems that don't support it.
558
559 Other changes
560 -------------
561
562 * Wheels include zlib 1.3, libxml2 2.10.3 and libxslt 1.1.39
563 (zlib 1.2.12, libxml2 2.10.3 and libxslt 1.1.37 on Windows).
564
565 * Built with Cython 0.29.37.
566
567
568 4.9.3 (2023-07-05)
569 ==================
570
571 Bugs fixed
572 ----------
573
574 * LP#2008911: ``lxml.objectify`` accepted non-decimal numbers like ``²²²`` as integers.
575
576 * A memory leak in ``lxml.html.clean`` was resolved by switching to Cython 0.29.34+.
577
578 * GH#348: URL checking in the HTML cleaner was improved.
579 Patch by Tim McCormack.
580
581 * GH#371, GH#373: Some regex strings were changed to raw strings to fix Python warnings.
582 Patches by Jakub Wilk and Anthony Sottile.
583
584 Other changes
585 -------------
586
587 * Wheels include zlib 1.2.13, libxml2 2.10.3 and libxslt 1.1.38
588 (zlib 1.2.12, libxml2 2.10.3 and libxslt 1.1.37 on Windows).
589
590 * Built with Cython 0.29.36 to adapt to changes in Python 3.12.
591
592
593 4.9.2 (2022-12-13)
594 ==================
595
596 Bugs fixed
597 ----------
598
599 * CVE-2022-2309: A Bug in libxml2 2.9.1[0-4] could let namespace declarations
600 from a failed parser run leak into later parser runs. This bug was worked around
601 in lxml and resolved in libxml2 2.10.0.
602 https://gitlab.gnome.org/GNOME/libxml2/-/issues/378
603
604 Other changes
605 -------------
606
607 * LP#1981760: ``Element.attrib`` now registers as ``collections.abc.MutableMapping``.
608
609 * lxml now has a static build setup for macOS on ARM64 machines (not used for building wheels).
610 Patch by Quentin Leffray.
611
612
613 4.9.1 (2022-07-01)
614 ==================
615
616 Bugs fixed
617 ----------
618
619 * A crash was resolved when using ``iterwalk()`` (or ``canonicalize()``)
620 after parsing certain incorrect input. Note that ``iterwalk()`` can crash
621 on *valid* input parsed with the same parser *after* failing to parse the
622 incorrect input.
623
624
625 4.9.0 (2022-06-01)
626 ==================
627
628 Bugs fixed
629 ----------
630
631 * GH#341: The mixin inheritance order in ``lxml.html`` was corrected.
632 Patch by xmo-odoo.
633
634 Other changes
635 -------------
636
637 * Built with Cython 0.29.30 to adapt to changes in Python 3.11 and 3.12.
638
639 * Wheels include zlib 1.2.12, libxml2 2.9.14 and libxslt 1.1.35
640 (libxml2 2.9.12+ and libxslt 1.1.34 on Windows).
641
642 * GH#343: Windows-AArch64 build support in Visual Studio.
643 Patch by Steve Dower.
644
645
646 4.8.0 (2022-02-17)
647 ==================
648
649 Features added
650 --------------
651
652 * GH#337: Path-like objects are now supported throughout the API instead of just strings.
653 Patch by Henning Janssen.
654
655 * The ``ElementMaker`` now supports ``QName`` values as tags, which always override
656 the default namespace of the factory.
657
658 Bugs fixed
659 ----------
660
661 * GH#338: In lxml.objectify, the XSI float annotation "nan" and "inf" were spelled in
662 lower case, whereas XML Schema datatypes define them as "NaN" and "INF" respectively.
663 Patch by Tobias Deiminger.
664
665 Other changes
666 -------------
667
668 * Built with Cython 0.29.28.
669
670
671 4.7.1 (2021-12-13)
672 ==================
673
674 Features added
675 --------------
676
677 * Chunked Unicode string parsing via ``parser.feed()`` now encodes the input data
678 to the native UTF-8 encoding directly, instead of going through ``Py_UNICODE`` /
679 ``wchar_t`` encoding first, which previously required duplicate recoding in most cases.
680
681 Bugs fixed
682 ----------
683
684 * The standard namespace prefixes were mishandled during "C14N2" serialisation on Python 3.
685 See https://mail.python.org/archives/list/[email protected]/thread/6ZFBHFOVHOS5GFDOAMPCT6HM5HZPWQ4Q/
686
687 * ``lxml.objectify`` previously accepted non-XML numbers with underscores (like "1_000")
688 as integers or float values in Python 3.6 and later. It now adheres to the number
689 format of the XML spec again.
690
691 * LP#1939031: Static wheels of lxml now contain the header files of zlib and libiconv
692 (in addition to the already provided headers of libxml2/libxslt/libexslt).
693
694 Other changes
695 -------------
696
697 * Wheels include libxml2 2.9.12+ and libxslt 1.1.34 (also on Windows).
698
699
700 4.7.0 (2021-12-13)
701 ==================
702
703 * Release retracted due to missing files in lxml/includes/.
704
705
706 4.6.5 (2021-12-12)
707 ==================
708
709 Bugs fixed
710 ----------
711
712 * A vulnerability (GHSL-2021-1038) in the HTML cleaner allowed sneaking script
713 content through SVG images (CVE-2021-43818).
714
715 * A vulnerability (GHSL-2021-1037) in the HTML cleaner allowed sneaking script
716 content through CSS imports and other crafted constructs (CVE-2021-43818).
717
718
719 4.6.4 (2021-11-01)
720 ==================
721
722 Features added
723 --------------
724
725 * GH#317: A new property ``system_url`` was added to DTD entities.
726 Patch by Thirdegree.
727
728 * GH#314: The ``STATIC_*`` variables in ``setup.py`` can now be passed via env vars.
729 Patch by Isaac Jurado.
730
731
732 4.6.3 (2021-03-21)
733 ==================
734
735 Bugs fixed
736 ----------
737
738 * A vulnerability (CVE-2021-28957) was discovered in the HTML Cleaner by Kevin Chung,
739 which allowed JavaScript to pass through. The cleaner now removes the HTML5
740 ``formaction`` attribute.
741
742
743 4.6.2 (2020-11-26)
744 ==================
745
746 Bugs fixed
747 ----------
748
749 * A vulnerability (CVE-2020-27783) was discovered in the HTML Cleaner by Yaniv Nizry,
750 which allowed JavaScript to pass through. The cleaner now removes more sneaky
751 "style" content.
752
753
754 4.6.1 (2020-10-18)
755 ==================
756
757 Bugs fixed
758 ----------
759
760 * A vulnerability was discovered in the HTML Cleaner by Yaniv Nizry, which allowed
761 JavaScript to pass through. The cleaner now removes more sneaky "style" content.
762
763
764 4.6.0 (2020-10-17)
765 ==================
766
767 Features added
768 --------------
769
770 * GH#310: ``lxml.html.InputGetter`` supports ``__len__()`` to count the number of input fields.
771 Patch by Aidan Woolley.
772
773 * ``lxml.html.InputGetter`` has a new ``.items()`` method to ease processing all input fields.
774
775 * ``lxml.html.InputGetter.keys()`` now returns the field names in document order.
776
777 * GH-309: The API documentation is now generated using ``sphinx-apidoc``.
778 Patch by Chris Mayo.
779
780 Bugs fixed
781 ----------
782
783 * LP#1869455: C14N 2.0 serialisation failed for unprefixed attributes
784 when a default namespace was defined.
785
786 * ``TreeBuilder.close()`` raised ``AssertionError`` in some error cases where it
787 should have raised ``XMLSyntaxError``. It now raises a combined exception to
788 keep up backwards compatibility, while switching to ``XMLSyntaxError`` as an
789 interface.
790
791
792 4.5.2 (2020-07-09)
793 ==================
794
795 Bugs fixed
796 ----------
797
798 * ``Cleaner()`` now validates that only known configuration options can be set.
799
800 * LP#1882606: ``Cleaner.clean_html()`` discarded comments and PIs regardless of the
801 corresponding configuration option, if ``remove_unknown_tags`` was set.
802
803 * LP#1880251: Instead of globally overwriting the document loader in libxml2, lxml now
804 sets it per parser run, which improves the interoperability with other users of libxml2
805 such as libxmlsec.
806
807 * LP#1881960: Fix build in CPython 3.10 by using Cython 0.29.21.
808
809 * The setup options "--with-xml2-config" and "--with-xslt-config" were accidentally renamed
810 to "--xml2-config" and "--xslt-config" in 4.5.1 and are now available again.
811
812
813 4.5.1 (2020-05-19)
814 ==================
815
816 Bugs fixed
817 ----------
818
819 * LP#1570388: Fix failures when serialising documents larger than 2GB in some cases.
820
821 * LP#1865141, GH#298: ``QName`` values were not accepted by the ``el.iter()`` method.
822 Patch by xmo-odoo.
823
824 * LP#1863413, GH#297: The build failed to detect libraries on Linux that are only
825 configured via pkg-config.
826 Patch by Hugh McMaster.
827
828
829 4.5.0 (2020-01-29)
830 ==================
831
832 Features added
833 --------------
834
835 * A new function ``indent()`` was added to insert tail whitespace for pretty-printing
836 an XML tree.
837
838 Bugs fixed
839 ----------
840
841 * LP#1857794: Tail text of nodes that get removed from a document using item
842 deletion disappeared silently instead of sticking with the node that was removed.
843
844 Other changes
845 -------------
846
847 * MacOS builds are 64-bit-only by default.
848 Set CFLAGS and LDFLAGS explicitly to override it.
849
850 * Linux/MacOS Binary wheels now use libxml2 2.9.10 and libxslt 1.1.34.
851
852 * LP#1840234: The package version number is now available as ``lxml.__version__``.
853
854
855 4.4.3 (2020-01-28)
856 ==================
857
858 Bugs fixed
859 ----------
860
861 * LP#1844674: ``itertext()`` was missing tail text of comments and PIs since 4.4.0.
862
863
864 4.4.2 (2019-11-25)
865 ==================
866
867 Bugs fixed
868 ----------
869
870 * LP#1835708: ``ElementInclude`` incorrectly rejected repeated non-recursive
871 includes as recursive.
872 Patch by Rainer Hausdorf.
873
874
875 4.4.1 (2019-08-11)
876 ==================
877
878 Bugs fixed
879 ----------
880
881 * LP#1838252: The order of an OrderedDict was lost in 4.4.0 when passing it as
882 attrib mapping during element creation.
883
884 * LP#1838521: The package metadata now lists the supported Python versions.
885
886
887 4.4.0 (2019-07-27)
888 ==================
889
890 Features added
891 --------------
892
893 * ``Element.clear()`` accepts a new keyword argument ``keep_tail=True`` to clear
894 everything but the tail text. This is helpful in some document-style use cases
895 and for clearing the current element in ``iterparse()`` and pull parsing.
896
897 * When creating attributes or namespaces from a dict in Python 3.6+, lxml now
898 preserves the original insertion order of that dict, instead of always sorting
899 the items by name. A similar change was made for ElementTree in CPython 3.8.
900 See https://bugs.python.org/issue34160
901
902 * Integer elements in ``lxml.objectify`` implement the ``__index__()`` special method.
903
904 * GH#269: Read-only elements in XSLT were missing the ``nsmap`` property.
905 Original patch by Jan Pazdziora.
906
907 * ElementInclude can now restrict the maximum inclusion depth via a ``max_depth``
908 argument to prevent content explosion. It is limited to 6 by default.
909
910 * The ``target`` object of the XMLParser can have ``start_ns()`` and ``end_ns()``
911 callback methods to listen to namespace declarations.
912
913 * The ``TreeBuilder`` has new arguments ``comment_factory`` and ``pi_factory`` to
914 pass factories for creating comments and processing instructions, as well as
915 flag arguments ``insert_comments`` and ``insert_pis`` to discard them from the
916 tree when set to false.
917
918 * A `C14N 2.0 <https://www.w3.org/TR/xml-c14n2/>`_ implementation was added as
919 ``etree.canonicalize()``, a corresponding ``C14NWriterTarget`` class, and
920 a ``c14n2`` serialisation method.
921
922 Bugs fixed
923 ----------
924
925 * When writing to file paths that contain the URL escape character '%', the file
926 path could wrongly be mangled by URL unescaping and thus write to a different
927 file or directory. Code that writes to file paths that are provided by untrusted
928 sources, but that must work with previous versions of lxml, should best either
929 reject paths that contain '%' characters, or otherwise make sure that the path
930 does not contain maliciously injected '%XX' URL hex escapes for paths like '../'.
931
932 * Assigning to Element child slices with negative step could insert the slice at
933 the wrong position, starting too far on the left.
934
935 * Assigning to Element child slices with overly large step size could take very
936 long, regardless of the length of the actual slice.
937
938 * Assigning to Element child slices of the wrong size could sometimes fail to
939 raise a ValueError (like a list assignment would) and instead assign outside
940 of the original slice bounds or leave parts of it unreplaced.
941
942 * The ``comment`` and ``pi`` events in ``iterwalk()`` were never triggered, and
943 instead, comments and processing instructions in the tree were reported as
944 ``start`` elements. Also, when walking an ElementTree (as opposed to its root
945 element), comments and PIs outside of the root element are now reported.
946
947 * LP#1827833: The RelaxNG compact syntax support was broken with recent versions
948 of ``rnc2rng``.
949
950 * LP#1758553: The HTML elements ``source`` and ``track`` were added to the list
951 of empty tags in ``lxml.html.defs``.
952
953 * Registering a prefix other than "xml" for the XML namespace is now rejected.
954
955 * Failing to write XSLT output to a file could raise a misleading exception.
956 It now raises ``IOError``.
957
958 Other changes
959 -------------
960
961 * Support for Python 3.4 was removed.
962
963 * When using ``Element.find*()`` with prefix-namespace mappings, the empty string
964 is now accepted to define a default namespace, in addition to the previously
965 supported ``None`` prefix. Empty strings are more convenient since they keep
966 all prefix keys in a namespace dict strings, which simplifies sorting etc.
967
968 * The ``ElementTree.write_c14n()`` method has been deprecated in favour of the
969 long preferred ``ElementTree.write(f, method="c14n")``. It will be removed
970 in a future release.
971
972
973 4.3.5 (2019-07-27)
974 ==================
975
976 * Rebuilt with Cython 0.29.13 to support Python 3.8.
977
978
979 4.3.4 (2019-06-10)
980 ==================
981
982 * Rebuilt with Cython 0.29.10 to support Python 3.8.
983
984
985 4.3.3 (2019-03-26)
986 ==================
987
988 Bugs fixed
989 ----------
990
991 * Fix leak of output buffer and unclosed files in ``_XSLTResultTree.write_output()``.
992
993
994 4.3.2 (2019-02-29)
995 ==================
996
997 Bugs fixed
998 ----------
999
1000 * Crash in 4.3.1 when appending a child subtree with certain text nodes.
1001
1002 Other changes
1003 -------------
1004
1005 * Built with Cython 0.29.6.
1006
1007
1008 4.3.1 (2019-02-08)
1009 ==================
1010
1011 Bugs fixed
1012 ----------
1013
1014 * LP#1814522: Crash when appending a child subtree that contains unsubstituted
1015 entity references.
1016
1017 Other changes
1018 -------------
1019
1020 * Built with Cython 0.29.5.
1021
1022
1023 4.3.0 (2019-01-04)
1024 ==================
1025
1026 Features added
1027 --------------
1028
1029 * The module ``lxml.sax`` is compiled using Cython in order to speed it up.
1030
1031 * GH#267: ``lxml.sax.ElementTreeProducer`` now preserves the namespace prefixes.
1032 If two prefixes point to the same URI, the first prefix in alphabetical order
1033 is used. Patch by Lennart Regebro.
1034
1035 * Updated ISO-Schematron implementation to 2013 version (now MIT licensed)
1036 and the corresponding schema to the 2016 version (with optional "properties").
1037
1038 Other changes
1039 -------------
1040
1041 * GH#270, GH#271: Support for Python 2.6 and 3.3 was removed.
1042 Patch by hugovk.
1043
1044 * The minimum dependency versions were raised to libxml2 2.9.2 and libxslt 1.1.27,
1045 which were released in 2014 and 2012 respectively.
1046
1047 * Built with Cython 0.29.2.
1048
1049
1050 4.2.6 (2019-01-02)
1051 ==================
1052
1053 Bugs fixed
1054 ----------
1055
1056 * LP#1799755: Fix a DeprecationWarning in Py3.7+.
1057
1058 * Import warnings in Python 3.6+ were resolved.
1059
1060
1061 4.2.5 (2018-09-09)
1062 ==================
1063
1064 Bugs fixed
1065 ----------
1066
1067 * Javascript URLs that used URL escaping were not removed by the HTML cleaner.
1068 Security problem found by Omar Eissa. (CVE-2018-19787)
1069
1070
1071 4.2.4 (2018-08-03)
1072 ==================
1073
1074 Features added
1075 --------------
1076
1077 * GH#259: Allow using ``pkg-config`` for build configuration.
1078 Patch by Patrick Griffis.
1079
1080 Bugs fixed
1081 ----------
1082
1083 * LP#1773749, GH#268: Crash when moving an element to another document with
1084 ``Element.insert()``.
1085 Patch by Alexander Weggerle.
1086
1087
1088 4.2.3 (2018-06-27)
1089 ==================
1090
1091 Bugs fixed
1092 ----------
1093
1094 * Reverted GH#265: lxml links against zlib as a shared library again.
1095
1096
1097 4.2.2 (2018-06-22)
1098 ==================
1099
1100 Bugs fixed
1101 ----------
1102
1103 * GH#266: Fix sporadic crash during GC when parse-time schema validation is used
1104 and the parser participates in a reference cycle.
1105 Original patch by Julien Greard.
1106
1107 * GH#265: lxml no longer links against zlib as a shared library, only on static builds.
1108 Patch by Nehal J Wani.
1109
1110
1111 4.2.1 (2018-03-21)
1112 ==================
1113
1114 Bugs fixed
1115 ----------
1116
1117 * LP#1755825: ``iterwalk()`` failed to return the 'start' event for the initial
1118 element if a tag selector is used.
1119
1120 * LP#1756314: Failure to import 4.2.0 into PyPy due to a missing library symbol.
1121
1122 * LP#1727864, GH#258: Add "-isysroot" linker option on MacOS as needed by XCode 9.
1123
1124
1125 4.2.0 (2018-03-13)
1126 ==================
1127
1128 Features added
1129 --------------
1130
1131 * GH#255: ``SelectElement.value`` returns more standard-compliant and
1132 browser-like defaults for non-multi-selects. If no option is selected, the
1133 value of the first option is returned (instead of None). If multiple options
1134 are selected, the value of the last one is returned (instead of that of the
1135 first one). If no options are present (not standard-compliant)
1136 ``SelectElement.value`` still returns ``None``.
1137
1138 * GH#261: The ``HTMLParser()`` now supports the ``huge_tree`` option.
1139 Patch by stranac.
1140
1141 Bugs fixed
1142 ----------
1143
1144 * LP#1551797: Some XSLT messages were not captured by the transform error log.
1145
1146 * LP#1737825: Crash at shutdown after an interrupted iterparse run with XMLSchema
1147 validation.
1148
1149 Other changes
1150 -------------
1151
1152
1153 4.1.1 (2017-11-04)
1154 ==================
1155
1156 * Rebuild with Cython 0.27.3 to improve support for Py3.7.
1157
1158
1159 4.1.0 (2017-10-13)
1160 ==================
1161
1162 Features added
1163 --------------
1164
1165 * ElementPath supports text predicates for current node, like "[.='text']".
1166
1167 * ElementPath allows spaces in predicates.
1168
1169 * Custom Element classes and XPath functions can now be registered with a
1170 decorator rather than explicit dict assignments.
1171
1172 * Static Linux wheels are now built with link time optimisation (LTO) enabled.
1173 This should have a beneficial impact on the overall performance by providing
1174 a tighter compiler integration between lxml and libxml2/libxslt.
1175
1176 Bugs fixed
1177 ----------
1178
1179 * LP#1722776: Requesting non-Element objects like comments from a document with
1180 ``PythonElementClassLookup`` could fail with a TypeError.
1181
1182
1183 4.0.0 (2017-09-17)
1184 ==================
1185
1186 Features added
1187 --------------
1188
1189 * The ElementPath implementation is now compiled using Cython,
1190 which speeds up the ``.find*()`` methods quite significantly.
1191
1192 * The modules ``lxml.builder``, ``lxml.html.diff`` and ``lxml.html.clean``
1193 are also compiled using Cython in order to speed them up.
1194
1195 * ``xmlfile()`` supports async coroutines using ``async with`` and ``await``.
1196
1197 * ``iterwalk()`` has a new method ``skip_subtree()`` that prevents walking into
1198 the descendants of the current element.
1199
1200 * ``RelaxNG.from_rnc_string()`` accepts a ``base_url`` argument to
1201 allow relative resource lookups.
1202
1203 * The XSLT result object has a new method ``.write_output(file)`` that serialises
1204 output data into a file according to the ``<xsl:output>`` configuration.
1205
1206 Bugs fixed
1207 ----------
1208
1209 * GH#251: HTML comments were handled incorrectly by the soupparser.
1210 Patch by mozbugbox.
1211
1212 * LP#1654544: The html5parser no longer passes the ``useChardet`` option
1213 if the input is a Unicode string, unless explicitly requested. When parsing
1214 files, the default is to enable it when a URL or file path is passed (because
1215 the file is then opened in binary mode), and to disable it when reading from
1216 a file(-like) object.
1217
1218 Note: This is a backwards incompatible change of the default configuration.
1219 If your code parses byte strings/streams and depends on character detection,
1220 please pass the option ``guess_charset=True`` explicitly, which already worked
1221 in older lxml versions.
1222
1223 * LP#1703810: ``etree.fromstring()`` failed to parse UTF-32 data with BOM.
1224
1225 * LP#1526522: Some RelaxNG errors were not reported in the error log.
1226
1227 * LP#1567526: Empty and plain text input raised a TypeError in soupparser.
1228
1229 * LP#1710429: Uninitialised variable usage in HTML diff.
1230
1231 * LP#1415643: The closing tags context manager in ``xmlfile()`` could continue
1232 to output end tags even after writing failed with an exception.
1233
1234 * LP#1465357: ``xmlfile.write()`` now accepts and ignores None as input argument.
1235
1236 * Compilation under Py3.7-pre failed due to a modified function signature.
1237
1238 Other changes
1239 -------------
1240
1241 * The main module source files were renamed from ``lxml.*.pyx`` to plain
1242 ``*.pyx`` (e.g. ``etree.pyx``) to simplify their handling in the build
1243 process. Care was taken to keep the old header files as fallbacks for
1244 code that compiles against the public C-API of lxml, but it might still
1245 be worth validating that third-party code does not notice this change.
1246
1247
1248 3.8.0 (2017-06-03)
1249 ==================
1250
1251 Features added
1252 --------------
1253
1254 * ``ElementTree.write()`` has a new option ``doctype`` that writes out a
1255 doctype string before the serialisation, in the same way as ``tostring()``.
1256
1257 * GH#220: ``xmlfile`` allows switching output methods at an element level.
1258 Patch by Burak Arslan.
1259
1260 * LP#1595781, GH#240: added a PyCapsule Python API and C-level API for
1261 passing externally generated libxml2 documents into lxml.
1262
1263 * GH#244: error log entries have a new property ``path`` with an XPath
1264 expression (if known, None otherwise) that points to the tree element
1265 responsible for the error. Patch by Bob Kline.
1266
1267 * The namespace prefix mapping that can be used in ElementPath now injects
1268 a default namespace when passing a None prefix.
1269
1270 Bugs fixed
1271 ----------
1272
1273 * GH#238: Character escapes were not hex-encoded in the ``xmlfile`` serialiser.
1274 Patch by matejcik.
1275
1276 * GH#229: fix for externally created XML documents. Patch by Theodore Dubois.
1277
1278 * LP#1665241, GH#228: Form data handling in lxml.html no longer strips the
1279 option values specified in form attributes but only the text values.
1280 Patch by Ashish Kulkarni.
1281
1282 * LP#1551797: revert previous fix for XSLT error logging as it breaks
1283 multi-threaded XSLT processing.
1284
1285 * LP#1673355, GH#233: ``fromstring()`` html5parser failed to parse byte strings.
1286
1287 Other changes
1288 -------------
1289
1290 * The previously undocumented ``docstring`` option in ``ElementTree.write()``
1291 produces a deprecation warning and will eventually be removed.
1292
1293
1294 3.7.4 (2017-??-??)
1295 ==================
1296
1297 Bugs fixed
1298 ----------
1299
1300 * LP#1551797: revert previous fix for XSLT error logging as it breaks
1301 multi-threaded XSLT processing.
1302
1303 * LP#1673355, GH#233: ``fromstring()`` html5parser failed to parse byte strings.
1304
1305
1306 3.7.3 (2017-02-18)
1307 ==================
1308
1309 Bugs fixed
1310 ----------
1311
1312 * GH#218 was ineffective in Python 3.
1313
1314 * GH#222: ``lxml.html.submit_form()`` failed in Python 3.
1315 Patch by Jakub Wilk.
1316
1317
1318 3.7.2 (2017-01-08)
1319 ==================
1320
1321 * GH#220: ``xmlfile`` allows switching output methods at an element level.
1322 Patch by Burak Arslan.
1323
1324 Bugs fixed
1325 ----------
1326
1327 * Work around installation problems in recent Python 2.7 versions
1328 due to FTP download failures.
1329
1330 * GH#219: ``xmlfile.element()`` was not properly quoting attribute values.
1331 Patch by Burak Arslan.
1332
1333 * GH#218: ``xmlfile.element()`` was not properly escaping text content of
1334 script/style tags. Patch by Burak Arslan.
1335
1336
1337 3.7.1 (2016-12-23)
1338 ==================
1339
1340 * No source changes, issued only to solve problems with the
1341 binary packages released for 3.7.0.
1342
1343
1344 3.7.0 (2016-12-10)
1345 ==================
1346
1347 Features added
1348 --------------
1349
1350 * GH#217: ``XMLSyntaxError`` now behaves more like its ``SyntaxError``
1351 baseclass. Patch by Philipp A.
1352
1353 * GH#216: ``HTMLParser()`` now supports the same ``collect_ids`` parameter
1354 as ``XMLParser()``. Patch by Burak Arslan.
1355
1356 * GH#210: Allow specifying a serialisation method in ``xmlfile.write()``.
1357 Patch by Burak Arslan.
1358
1359 * GH#203: New option ``default_doctype`` in ``HTMLParser`` that allows
1360 disabling the automatic doctype creation. Patch by Shadab Zafar.
1361
1362 * GH#201: Calling the method ``.set('attrname')`` without value argument
1363 (or ``None``) on HTML elements creates an attribute without value that
1364 serialises like ``<div attrname></div>``. Patch by Daniel Holth.
1365
1366 * GH#197: Ignore form input fields in ``form_values()`` when they are
1367 marked as ``disabled`` in HTML. Patch by Kristian Klemon.
1368
1369 Bugs fixed
1370 ----------
1371
1372 * GH#206: File name and line number were missing from XSLT error messages.
1373 Patch by Marcus Brinkmann.
1374
1375 Other changes
1376 -------------
1377
1378 * Log entries no longer allow anything but plain string objects as message text
1379 and file name.
1380
1381 * ``zlib`` is included in the list of statically built libraries.
1382
1383
1384 3.6.4 (2016-08-20)
1385 ==================
1386
1387 * GH#204, LP#1614693: build fix for MacOS-X.
1388
1389
1390 3.6.3 (2016-08-18)
1391 ==================
1392
1393 * LP#1614603: change linker flags to build multi-linux wheels
1394
1395
1396 3.6.2 (2016-08-18)
1397 ==================
1398
1399 * LP#1614603: release without source changes to provide cleanly built Linux wheels
1400
1401
1402 3.6.1 (2016-07-24)
1403 ==================
1404
1405 Features added
1406 --------------
1407
1408 * GH#180: Separate option ``inline_style`` for Cleaner that only removes ``style``
1409 attributes instead of all styles. Patch by Christian Pedersen.
1410
1411 * GH#196: Windows build support for Python 3.5. Contribution by Maximilian Hils.
1412
1413 Bugs fixed
1414 ----------
1415
1416 * GH#199: Exclude ``file`` fields from ``FormElement.form_values`` (as browsers do).
1417 Patch by Tomas Divis.
1418
1419 * GH#198, LP#1568167: Try to provide base URL from ``Resolver.resolve_string()``.
1420 Patch by Michael van Tellingen.
1421
1422 * GH#191: More accurate float serialisation in ``objectify.FloatElement``.
1423 Patch by Holger Joukl.
1424
1425 * LP#1551797: Repair XSLT error logging. Patch by Marcus Brinkmann.
1426
1427
1428 3.6.0 (2016-03-17)
1429 ==================
1430
1431 Features added
1432 --------------
1433
1434 * GH#187: Now supports (only) version 5.x and later of PyPy.
1435 Patch by Armin Rigo.
1436
1437 * GH#181: Direct support for ``.rnc`` files in `RelaxNG()` if ``rnc2rng``
1438 is installed. Patch by Dirkjan Ochtman.
1439
1440 Bugs fixed
1441 ----------
1442
1443 * GH#189: Static builds honour FTP proxy configurations when downloading
1444 the external libs. Patch by Youhei Sakurai.
1445
1446 * GH#186: Soupparser failed to process entities in Python 3.x.
1447 Patch by Duncan Morris.
1448
1449 * GH#185: Rare encoding related ``TypeError`` on import was fixed.
1450 Patch by Petr Demin.
1451
1452
1453 3.5.0 (2015-11-13)
1454 ==================
1455
1456 Bugs fixed
1457 ----------
1458
1459 * Unicode string results failed XPath queries in PyPy.
1460
1461 * LP#1497051: HTML target parser failed to terminate on exceptions
1462 and continued parsing instead.
1463
1464 * Deprecated API usage in doctestcompare.
1465
1466
1467 3.5.0b1 (2015-09-18)
1468 ====================
1469
1470 Features added
1471 --------------
1472
1473 * ``cleanup_namespaces()`` accepts a new argument ``keep_ns_prefixes``
1474 that does not remove definitions of the provided prefix-namespace
1475 mapping from the tree.
1476
1477 * ``cleanup_namespaces()`` accepts a new argument ``top_nsmap`` that
1478 moves definitions of the provided prefix-namespace mapping to the
1479 top of the tree.
1480
1481 * LP#1490451: ``Element`` objects gained a ``cssselect()`` method as
1482 known from ``lxml.html``. Patch by Simon Sapin.
1483
1484 * API functions and methods behave and look more like Python functions,
1485 which allows introspection on them etc. One side effect to be aware of
1486 is that the functions now bind as methods when assigned to a class
1487 variable. A quick fix is to wrap them in ``staticmethod()`` (as for
1488 normal Python functions).
1489
1490 * ISO-Schematron support gained an option ``error_finder`` that allows
1491 passing a filter function for picking validation errors from reports.
1492
1493 * LP#1243600: Elements in ``lxml.html`` gained a ``classes`` property
1494 that provides a set-like interface to the ``class`` attribute.
1495 Original patch by masklinn.
1496
1497 * LP#1341964: The soupparser now handles DOCTYPE declarations, comments
1498 and processing instructions outside of the root element.
1499 Patch by Olli Pottonen.
1500
1501 * LP#1421512: The ``docinfo`` of a tree was made editable to allow
1502 setting and removing the public ID and system ID of the DOCTYPE.
1503 Patch by Olli Pottonen.
1504
1505 * LP#1442427: More work-arounds for quirks and bugs in pypy and pypy3.
1506
1507 * ``lxml.html.soupparser`` now uses BeautifulSoup version 4 instead
1508 of version 3 if available.
1509
1510 Bugs fixed
1511 ----------
1512
1513 * Memory errors that occur during tree adaptations (e.g. moving subtrees
1514 to foreign documents) could leave the tree in a crash prone state.
1515
1516 * Calling ``process_children()`` in an XSLT extension element without
1517 an ``output_parent`` argument failed with a ``TypeError``.
1518 Fix by Jens Tröger.
1519
1520 * GH#162: Image data in HTML ``data`` URLs is considered safe and
1521 no longer removed by ``lxml.html.clean`` JavaScript cleaner.
1522
1523 * GH#166: Static build could link libraries in wrong order.
1524
1525 * GH#172: Rely a bit more on libxml2 for encoding detection rather than
1526 rolling our own in some cases. Patch by Olli Pottonen.
1527
1528 * GH#159: Validity checks for names and string content were tightened
1529 to detect the use of illegal characters early. Patch by Olli Pottonen.
1530
1531 * LP#1421921: Comments/PIs before the DOCTYPE declaration were not
1532 serialised. Patch by Olli Pottonen.
1533
1534 * LP#659367: Some HTML DOCTYPE declarations were not serialised.
1535 Patch by Olli Pottonen.
1536
1537 * LP#1238503: lxml.doctestcompare is now consistent with stdlib's doctest
1538 in how it uses ``+`` and ``-`` to refer to unexpected and missing output.
1539
1540 * Empty prefixes are explicitly rejected when a namespace mapping is used
1541 with ElementPath to avoid hiding bugs in user code.
1542
1543 * Several problems with PyPy were fixed by switching to Cython 0.23.
1544
1545
1546 3.4.4 (2015-04-25)
1547 ==================
1548
1549 Bugs fixed
1550 ----------
1551
1552 * An ElementTree compatibility test added in lxml 3.4.3 that failed in
1553 Python 3.4+ was removed again.
1554
1555
1556 3.4.3 (2015-04-15)
1557 ==================
1558
1559 Bugs fixed
1560 ----------
1561
1562 * Expression cache in ElementPath was ignored. Fix by Changaco.
1563
1564 * LP#1426868: Passing a default namespace and a prefixed namespace mapping
1565 as nsmap into ``xmlfile.element()`` raised a ``TypeError``.
1566
1567 * LP#1421927: DOCTYPE system URLs were incorrectly quoted when containing
1568 double quotes. Patch by Olli Pottonen.
1569
1570 * LP#1419354: meta-redirect URLs were incorrectly processed by
1571 ``iterlinks()`` if preceded by whitespace.
1572
1573
1574 3.4.2 (2015-02-07)
1575 ==================
1576
1577 Bugs fixed
1578 ----------
1579
1580 * LP#1415907: Crash when creating an XMLSchema from a non-root element
1581 of an XML document.
1582
1583 * LP#1369362: HTML cleaning failed when hitting processing instructions
1584 with pseudo-attributes.
1585
1586 * ``CDATA()`` wrapped content was rejected for tail text.
1587
1588 * CDATA sections were not serialised as tail text of the top-level element.
1589
1590
1591 3.4.1 (2014-11-20)
1592 ==================
1593
1594 Features added
1595 --------------
1596
1597 * New ``htmlfile`` HTML generator to accompany the incremental ``xmlfile``
1598 serialisation API. Patch by Burak Arslan.
1599
1600 Bugs fixed
1601 ----------
1602
1603 * ``lxml.sax.ElementTreeContentHandler`` did not initialise its superclass.
1604
1605
1606 3.4.0 (2014-09-10)
1607 ==================
1608
1609 Features added
1610 --------------
1611
1612 * ``xmlfile(buffered=False)`` disables output buffering and flushes the
1613 content after each API operation (starting/ending element blocks or writes).
1614 A new method ``xf.flush()`` can alternatively be used to explicitly flush
1615 the output.
1616
1617 * ``lxml.html.document_fromstring`` has a new option ``ensure_head_body=True``
1618 which will add an empty head and/or body element to the result document if
1619 missing.
1620
1621 * ``lxml.html.iterlinks`` now returns links inside meta refresh tags.
1622
1623 * New ``XMLParser`` option ``collect_ids=False`` to disable ID hash table
1624 creation. This can substantially speed up parsing of documents with many
1625 different IDs that are not used.
1626
1627 * The parser uses per-document hash tables for XML IDs. This reduces the
1628 load of the global parser dict and speeds up parsing for documents with
1629 many different IDs.
1630
1631 * ``ElementTree.getelementpath(element)`` returns a structural ElementPath
1632 expression for the given element, which can be used for lookups later.
1633
1634 * ``xmlfile()`` accepts a new argument ``close=True`` to close file(-like)
1635 objects after writing to them. Before, ``xmlfile()`` only closed the file
1636 if it had opened it internally.
1637
1638 * Allow "bytearray" type for ASCII text input.
1639
1640 Bugs fixed
1641 ----------
1642
1643 Other changes
1644 -------------
1645
1646 * LP#400588: decoding errors have become hard errors even in recovery mode.
1647 Previously, they could lead to an internal tree representation in a mixed
1648 encoding state, which lead to very late errors or even silently incorrect
1649 behaviour during tree traversal or serialisation.
1650
1651 * Requires Python 2.6, 2.7, 3.2 or later. No longer supports
1652 Python 2.4, 2.5 and 3.1, use lxml 3.3.x for those.
1653
1654 * Requires libxml2 2.7.0 or later and libxslt 1.1.23 or later,
1655 use lxml 3.3.x with older versions.
1656
1657
1658 3.3.6 (2014-08-28)
1659 ==================
1660
1661 Bugs fixed
1662 ----------
1663
1664 * Prevent tree cycle creation when adding Elements as siblings.
1665
1666 * LP#1361948: crash when deallocating Element siblings without parent.
1667
1668 * LP#1354652: crash when traversing internally loaded documents in XSLT
1669 extension functions.
1670
1671
1672 3.3.5 (2014-04-18)
1673 ==================
1674
1675 Bugs fixed
1676 ----------
1677
1678 * HTML cleaning could fail to strip javascript links that mix control
1679 characters into the link scheme.
1680
1681
1682 3.3.4 (2014-04-03)
1683 ==================
1684
1685 Features added
1686 --------------
1687
1688 * Source line numbers above 65535 are available on Elements when
1689 using libxml2 2.9 or later.
1690
1691 Bugs fixed
1692 ----------
1693
1694 * ``lxml.html.fragment_fromstring()`` failed for bytes input in Py3.
1695
1696 Other changes
1697 -------------
1698
1699
1700 3.3.3 (2014-03-04)
1701 ==================
1702
1703 Bugs fixed
1704 ----------
1705
1706 * LP#1287118: Crash when using Element subtypes with ``__slots__``.
1707
1708 Other changes
1709 -------------
1710
1711 * The internal classes ``_LogEntry`` and ``_Attrib`` can no longer be
1712 subclassed from Python code.
1713
1714
1715 3.3.2 (2014-02-26)
1716 ==================
1717
1718 Bugs fixed
1719 ----------
1720
1721 * The properties ``resolvers`` and ``version``, as well as the methods
1722 ``set_element_class_lookup()`` and ``makeelement()``, were lost from
1723 ``iterparse`` objects in 3.3.0.
1724
1725 * LP#1222132: instances of ``XMLSchema``, ``Schematron`` and ``RelaxNG``
1726 did not clear their local ``error_log`` before running a validation.
1727
1728 * LP#1238500: lxml.doctestcompare mixed up "expected" and "actual" in
1729 attribute values.
1730
1731 * Some file I/O tests were failing in MS-Windows due to non-portable temp
1732 file usage. Initial patch by Gabi Davar.
1733
1734 * LP#910014: duplicate IDs in a document were not reported by DTD validation.
1735
1736 * LP#1185332: ``tostring(method="html")`` did not use HTML serialisation
1737 semantics for trailing tail text. Initial patch by Sylvain Viollon.
1738
1739 * LP#1281139: ``.attrib`` value of Comments lost its mutation methods
1740 in 3.3.0. Even though it is empty and immutable, it should still
1741 provide the same interface as that returned for Elements.
1742
1743
1744 3.3.1 (2014-02-12)
1745 ==================
1746
1747 Features added
1748 --------------
1749
1750 Bugs fixed
1751 ----------
1752
1753 * LP#1014290: HTML documents parsed with ``parser.feed()`` failed to find
1754 elements during tag iteration.
1755
1756 * LP#1273709: Building in PyPy failed due to missing support for
1757 ``PyUnicode_Compare()`` and ``PyByteArray_*()`` in PyPy's C-API.
1758
1759 * LP#1274413: Compilation in MSVC failed due to missing "stdint.h" standard
1760 header file.
1761
1762 * LP#1274118: iterparse() failed to parse BOM prefixed files.
1763
1764 Other changes
1765 -------------
1766
1767
1768 3.3.0 (2014-01-26)
1769 ==================
1770
1771 Features added
1772 --------------
1773
1774 Bugs fixed
1775 ----------
1776
1777 * The heuristic that distinguishes file paths from URLs was tightened
1778 to produce less false negatives.
1779
1780 Other changes
1781 -------------
1782
1783
1784 3.3.0beta5 (2014-01-18)
1785 =======================
1786
1787 Features added
1788 --------------
1789
1790 * The PEP 393 unicode parsing support gained a fallback for wchar strings
1791 which might still be somewhat common on Windows systems.
1792
1793 Bugs fixed
1794 ----------
1795
1796 * Several error handling problems were fixed throughout the code base that
1797 could previously lead to exceptions being silently swallowed or not
1798 properly reported.
1799
1800 * The C-API function ``appendChild()`` is now deprecated as it does not
1801 propagate exceptions (its return type is ``void``). The new function
1802 ``appendChildToElement()`` was added as a safe replacement.
1803
1804 * Passing a string into ``fromstringlist()`` raises an exception instead of
1805 parsing the string character by character.
1806
1807 Other changes
1808 -------------
1809
1810 * Document cleanup code was simplified using the new GC features in
1811 Cython 0.20.
1812
1813
1814 3.3.0beta4 (2014-01-12)
1815 =======================
1816
1817 Features added
1818 --------------
1819
1820 Bugs fixed
1821 ----------
1822
1823 * The (empty) value returned by the ``attrib`` property of Entity and Comment
1824 objects was mutable.
1825
1826 * Element class lookup wasn't available for the new pull parsers or when using
1827 a custom parser target.
1828
1829 * Setting Element attributes on instantiation with both the ``attrib`` argument
1830 and keyword arguments could modify the mapping passed as ``attrib``.
1831
1832 * LP#1266171: DTDs instantiated from internal/external subsets (i.e. through
1833 the docinfo property) lost their attribute declarations.
1834
1835 Other changes
1836 -------------
1837
1838 * Built with Cython 0.20pre (gitrev 012ae82eb) to prepare support for
1839 Python 3.4.
1840
1841
1842 3.3.0beta3 (2014-01-02)
1843 =======================
1844
1845 Features added
1846 --------------
1847
1848 * Unicode string parsing was optimised for Python 3.3 (PEP 393).
1849
1850 Bugs fixed
1851 ----------
1852
1853 * HTML parsing of Unicode strings could misdecode the input on some platforms.
1854
1855 * Crash in xmlfile() when closing open elements out of order in an error case.
1856
1857 Other changes
1858 -------------
1859
1860
1861 3.3.0beta2 (2013-12-20)
1862 =======================
1863
1864 Features added
1865 --------------
1866
1867 * ``iterparse()`` supports the ``recover`` option.
1868
1869 Bugs fixed
1870 ----------
1871
1872 * Crash in ``iterparse()`` for HTML parsing.
1873
1874 * Crash in target parsing with attributes.
1875
1876 Other changes
1877 -------------
1878
1879 * The safety check in the read-only tree implementation (e.g. used by
1880 ``PythonElementClassLookup``) raises a more appropriate ``ReferenceError``
1881 for illegal access after tree disposal instead of an ``AssertionError``.
1882 This should only impact test code that specifically checks the original
1883 behaviour.
1884
1885
1886 3.3.0beta1 (2013-12-12)
1887 =======================
1888
1889 Features added
1890 --------------
1891
1892 * New option ``handle_failures`` in ``make_links_absolute()`` and
1893 ``resolve_base_href()`` (lxml.html) that enables ignoring or
1894 discarding links that fail to parse as URLs.
1895
1896 * New parser classes ``XMLPullParser`` and ``HTMLPullParser`` for
1897 incremental parsing, as implemented for ElementTree in Python 3.4.
1898
1899 * ``iterparse()`` enables recovery mode by default for HTML parsing
1900 (``html=True``).
1901
1902 Bugs fixed
1903 ----------
1904
1905 * LP#1255132: crash when trying to run validation over non-Element (e.g.
1906 comment or PI).
1907
1908 * Error messages in the log and in exception messages that originated
1909 from libxml2 could accidentally be picked up from preceding warnings
1910 instead of the actual error.
1911
1912 * The ``ElementMaker`` in lxml.objectify did not accept a dict as
1913 argument for adding attributes to the element it's building. This
1914 works as in lxml.builder now.
1915
1916 * LP#1228881: ``repr(XSLTAccessControl)`` failed in Python 3.
1917
1918 * Raise ``ValueError`` when trying to append an Element to itself or
1919 to one of its own descendants, instead of running into an infinite
1920 loop.
1921
1922 * LP#1206077: htmldiff discarded whitespace from the output.
1923
1924 * Compressed plain-text serialisation to file-like objects was broken.
1925
1926 * lxml.html.formfill: Fix textarea form filling.
1927 The textarea used to be cleared before the new content was set,
1928 which removed the name attribute.
1929
1930
1931 Other changes
1932 -------------
1933
1934 * Some basic API classes use freelists internally for faster
1935 instantiation. This can speed up some ``iterparse()`` scenarios,
1936 for example.
1937
1938 * ``iterparse()`` was rewritten to use the new ``*PullParser``
1939 classes internally instead of being a parser itself.
1940
1941
1942 3.2.5 (2014-01-02)
1943 ==================
1944
1945 Features added
1946 --------------
1947
1948 Bugs fixed
1949 ----------
1950
1951 * Crash in xmlfile() when closing open elements out of order in an error case.
1952
1953 * Crash in target parsing with attributes.
1954
1955 * LP#1255132: crash when trying to run validation over non-Element (e.g.
1956 comment or PI).
1957
1958 Other changes
1959 -------------
1960
1961
1962 3.2.4 (2013-11-07)
1963 ==================
1964
1965 Features added
1966 --------------
1967
1968 Bugs fixed
1969 ----------
1970
1971 * Memory leak when creating an XPath evaluator in a thread.
1972
1973 * LP#1228881: ``repr(XSLTAccessControl)`` failed in Python 3.
1974
1975 * Raise ``ValueError`` when trying to append an Element to itself or
1976 to one of its own descendants.
1977
1978 * LP#1206077: htmldiff discarded whitespace from the output.
1979
1980 * Compressed plain-text serialisation to file-like objects was broken.
1981
1982 Other changes
1983 -------------
1984
1985
1986 3.2.3 (2013-07-28)
1987 ==================
1988
1989 Bugs fixed
1990 ----------
1991
1992 * Fix support for Python 2.4 which was lost in 3.2.2.
1993
1994
1995 3.2.2 (2013-07-28)
1996 ==================
1997
1998 Features added
1999 --------------
2000
2001 Bugs fixed
2002 ----------
2003
2004 * LP#1185701: spurious XMLSyntaxError after finishing iterparse().
2005
2006 * Crash in lxml.objectify during xsi annotation.
2007
2008 Other changes
2009 -------------
2010
2011 * Return values of user provided element class lookup methods are now
2012 validated against the type of the XML node they represent to prevent
2013 API class mismatches.
2014
2015
2016 3.2.1 (2013-05-11)
2017 ==================
2018
2019 Features added
2020 --------------
2021
2022 * The methods ``apply_templates()`` and ``process_children()`` of XSLT
2023 extension elements have gained two new boolean options ``elements_only``
2024 and ``remove_blank_text`` that discard either all strings or whitespace-only
2025 strings from the result list.
2026
2027 Bugs fixed
2028 ----------
2029
2030 * When moving Elements to another tree, the namespace cleanup mechanism
2031 no longer drops namespace prefixes from attributes for which it finds
2032 a default namespace declaration, to prevent them from appearing as
2033 unnamespaced attributes after serialisation.
2034
2035 * Returning non-type objects from a custom class lookup method could lead
2036 to a crash.
2037
2038 * Instantiating and using subtypes of Comments and ProcessingInstructions
2039 crashed.
2040
2041 Other changes
2042 -------------
2043
2044
2045 3.2.0 (2013-04-28)
2046 ==================
2047
2048 Features added
2049 --------------
2050
2051 Bugs fixed
2052 ----------
2053
2054 * LP#690319: Leading whitespace could change the behaviour of the string
2055 parsing functions in ``lxml.html``.
2056
2057 * LP#599318: The string parsing functions in ``lxml.html`` are more robust
2058 in the face of uncommon HTML content like framesets or missing body tags.
2059 Patch by Stefan Seelmann.
2060
2061 * LP#712941: I/O errors while trying to access files with paths that contain
2062 non-ASCII characters could raise ``UnicodeDecodeError`` instead of properly
2063 reporting the ``IOError``.
2064
2065 * LP#673205: Parsing from in-memory strings disabled network access in the
2066 default parser and made subsequent attempts to parse from a URL fail.
2067
2068 * LP#971754: lxml.html.clean appends 'nofollow' to 'rel' attributes instead
2069 of overwriting the current value.
2070
2071 * LP#715687: lxml.html.clean no longer discards scripts that are explicitly
2072 allowed by the user provided whitelist. Patch by Christine Koppelt.
2073
2074 Other changes
2075 -------------
2076
2077
2078 3.1.2 (2013-04-12)
2079 ==================
2080
2081 Features added
2082 --------------
2083
2084 Bugs fixed
2085 ----------
2086
2087 * LP#1136509: Passing attributes through the namespace-unaware API of
2088 the sax bridge (i.e. the ``handler.startElement()`` method) failed
2089 with a ``TypeError``. Patch by Mike Bayer.
2090
2091 * LP#1123074: Fix serialisation error in XSLT output when converting
2092 the result tree to a Unicode string.
2093
2094 * GH#105: Replace illegal usage of ``xmlBufLength()`` in libxml2 2.9.0
2095 by properly exported API function ``xmlBufUse()``.
2096
2097 Other changes
2098 -------------
2099
2100
2101 3.1.1 (2013-03-29)
2102 ==================
2103
2104 Features added
2105 --------------
2106
2107 Bugs fixed
2108 ----------
2109
2110 * LP#1160386: Write access to ``lxml.html.FormElement.fields`` raised
2111 an AttributeError in Py3.
2112
2113 * Illegal memory access during cleanup in incremental xmlfile writer.
2114
2115 Other changes
2116 -------------
2117
2118 * The externally useless class ``lxml.etree._BaseParser`` was removed
2119 from the module dict.
2120
2121
2122 3.1.0 (2013-02-10)
2123 ==================
2124
2125 Features added
2126 --------------
2127
2128 * GH#89: lxml.html.clean allows overriding the set of attributes that it
2129 considers 'safe'. Patch by Francis Devereux.
2130
2131 Bugs fixed
2132 ----------
2133
2134 * LP#1104370: ``copy.copy(el.attrib)`` raised an exception. It now returns
2135 a copy of the attributes as a plain Python dict.
2136
2137 * GH#95: When used with namespace prefixes, the ``el.find*()`` methods
2138 always used the first namespace mapping that was provided for each
2139 path expression instead of using the one that was actually passed
2140 in for the current run.
2141
2142 * LP#1092521, GH#91: Fix undefined C symbol in Python runtimes compiled
2143 without threading support. Patch by Ulrich Seidl.
2144
2145 Other changes
2146 -------------
2147
2148
2149 3.1beta1 (2012-12-21)
2150 =====================
2151
2152 Features added
2153 --------------
2154
2155 * New build-time option ``--with-unicode-strings`` for Python 2 that
2156 makes the API always return Unicode strings for names and text
2157 instead of byte strings for plain ASCII content.
2158
2159 * New incremental XML file writing API ``etree.xmlfile()``.
2160
2161 * E factory in lxml.objectify is callable to simplify the creation of
2162 tags with non-identifier names without having to resort to getattr().
2163
2164 Bugs fixed
2165 ----------
2166
2167 * When starting from a non-namespaced element in lxml.objectify, searching
2168 for a child without explicitly specifying a namespace incorrectly found
2169 namespaced elements with the requested local name, instead of restricting
2170 the search to non-namespaced children.
2171
2172 * GH#85: Deprecation warnings were fixed for Python 3.x.
2173
2174 * GH#33: lxml.html.fromstring() failed to accept bytes input in Py3.
2175
2176 * LP#1080792: Static build of libxml2 2.9.0 failed due to missing file.
2177
2178 Other changes
2179 -------------
2180
2181 * The externally useless class ``_ObjectifyElementMakerCaller`` was
2182 removed from the module API of lxml.objectify.
2183
2184 * LP#1075622: lxml.builder is faster for adding text to elements with
2185 many children. Patch by Anders Hammarquist.
2186
2187
2188 3.0.2 (2012-12-14)
2189 ==================
2190
2191 Features added
2192 --------------
2193
2194 Bugs fixed
2195 ----------
2196
2197 * Fix crash during interpreter shutdown by switching to Cython 0.17.3 for building.
2198
2199 Other changes
2200 -------------
2201
2202
2203 3.0.1 (2012-10-14)
2204 ==================
2205
2206 Features added
2207 --------------
2208
2209 Bugs fixed
2210 ----------
2211
2212 * LP#1065924: Element proxies could disappear during garbage collection
2213 in PyPy without proper cleanup.
2214
2215 * GH#71: Failure to work with libxml2 2.6.x.
2216
2217 * LP#1065139: static MacOS-X build failed in Py3.
2218
2219 Other changes
2220 -------------
2221
2222
2223 3.0 (2012-10-08)
2224 ================
2225
2226 Features added
2227 --------------
2228
2229 Bugs fixed
2230 ----------
2231
2232 * End-of-file handling was incorrect in iterparse() when reading from
2233 a low-level C file stream and failed in libxml2 2.9.0 due to its
2234 improved consistency checks.
2235
2236 Other changes
2237 -------------
2238
2239 * The build no longer uses Cython by default unless the generated C files
2240 are missing. To use Cython, pass the option "--with-cython". To ignore
2241 the fatal build error when Cython is required but not available (e.g. to
2242 run special setup.py commands that do not actually run a build), pass
2243 "--without-cython".
2244
2245
2246 3.0beta1 (2012-09-26)
2247 =====================
2248
2249 Features added
2250 --------------
2251
2252 * Python level access to (optional) libxml2 memory debugging features
2253 to simplify debugging of memory leaks etc.
2254
2255 Bugs fixed
2256 ----------
2257
2258 * Fix a memory leak in XPath by switching to Cython 0.17.1.
2259
2260 * Some tests were adapted to work with PyPy.
2261
2262 Other changes
2263 -------------
2264
2265 * The code was adapted to work with the upcoming libxml2 2.9.0 release.
2266
2267
2268 3.0alpha2 (2012-08-23)
2269 ======================
2270
2271 Features added
2272 --------------
2273
2274 * The ``.iter()`` method of elements now accepts ``tag`` arguments like
2275 ``"{*}name"`` to search for elements with a given local name in any
2276 namespace. With this addition, all combinations of wildcards now work
2277 as expected:
2278 ``"{ns}name"``, ``"{}name"``, ``"{*}name"``, ``"{ns}*"``, ``"{}*"``
2279 and ``"{*}*"``. Note that ``"name"`` is equivalent to ``"{}name"``,
2280 but ``"*"`` is ``"{*}*"``.
2281 The same change applies to the ``.getiterator()``, ``.itersiblings()``,
2282 ``.iterancestors()``, ``.iterdescendants()``, ``.iterchildren()``
2283 and ``.itertext()`` methods;the ``strip_attributes()``,
2284 ``strip_elements()`` and ``strip_tags()`` functions as well as the
2285 ``iterparse()`` class. Patch by Simon Sapin.
2286
2287 * C14N allows specifying the inclusive prefixes to be promoted
2288 to top-level during exclusive serialisation.
2289
2290 Bugs fixed
2291 ----------
2292
2293 * Passing long Unicode strings into the ``feed()`` parser interface
2294 failed to read the entire string.
2295
2296 Other changes
2297 -------------
2298
2299
2300 3.0alpha1 (2012-07-31)
2301 ======================
2302
2303 Features added
2304 --------------
2305
2306 * Initial support for building in PyPy (through cpyext).
2307
2308 * DTD objects gained an API that allows read access to their
2309 declarations.
2310
2311 * ``xpathgrep.py`` gained support for parsing line-by-line (e.g.
2312 from grep output) and for surrounding the output with a new root
2313 tag.
2314
2315 * ``E-factory`` in ``lxml.builder`` accepts subtypes of known data
2316 types (such as string subtypes) when building elements around them.
2317
2318 * Tree iteration and ``iterparse()`` with a selective ``tag``
2319 argument supports passing a set of tags. Tree nodes will be
2320 returned by the iterators if they match any of the tags.
2321
2322 Bugs fixed
2323 ----------
2324
2325 * The ``.find*()`` methods in ``lxml.objectify`` no longer use XPath
2326 internally, which makes them faster in many cases (especially when
2327 short circuiting after a single or couple of elements) and fixes
2328 some behavioural differences compared to ``lxml.etree``. Note that
2329 this means that they no longer support arbitrary XPath expressions
2330 but only the subset that the ``ElementPath`` language supports.
2331 The previous implementation was also redundant with the normal
2332 XPath support, which can be used as a replacement.
2333
2334 * ``el.find('*')`` could accidentally return a comment or processing
2335 instruction that happened to be in the wrong spot. (Same for the
2336 other ``.find*()`` methods.)
2337
2338 * The error logging is less intrusive and avoids a global setup where
2339 possible.
2340
2341 * Fixed undefined names in html5lib parser.
2342
2343 * ``xpathgrep.py`` did not work in Python 3.
2344
2345 * ``Element.attrib.update()`` did not accept an ``attrib`` of
2346 another Element as parameter.
2347
2348 * For subtypes of ``ElementBase`` that make the ``.text`` or ``.tail``
2349 properties immutable (as in objectify, for example), inserting text
2350 when creating Elements through the E-Factory feature of the class
2351 constructor would fail with an exception, stating that the text
2352 cannot be modified.
2353
2354 Other changes
2355 --------------
2356
2357 * The code base was overhauled to properly use 'const' where the API
2358 of libxml2 and libxslt requests it. This also has an impact on the
2359 public C-API of lxml itself, as defined in ``etreepublic.pxd``, as
2360 well as the provided declarations in the ``lxml/includes/`` directory.
2361 Code that uses these declarations may have to be adapted. On the
2362 plus side, this fixes several C compiler warnings, also for user
2363 code, thus making it easier to spot real problems again.
2364
2365 * The functionality of "lxml.cssselect" was moved into a separate PyPI
2366 package called "cssselect". To continue using it, you must install
2367 that package separately. The "lxml.cssselect" module is still
2368 available and provides the same interface, provided the "cssselect"
2369 package can be imported at runtime.
2370
2371 * Element attributes passed in as an ``attrib`` dict or as keyword
2372 arguments are now sorted by (namespaced) name before being created
2373 to make their order predictable for serialisation and iteration.
2374 Note that adding or deleting attributes afterwards does not take
2375 that order into account, i.e. setting a new attribute appends it
2376 after the existing ones.
2377
2378 * Several classes that are for internal use only were removed
2379 from the ``lxml.etree`` module dict:
2380 ``_InputDocument, _ResolverRegistry, _ResolverContext, _BaseContext,
2381 _ExsltRegExp, _IterparseContext, _TempStore, _ExceptionContext,
2382 __ContentOnlyElement, _AttribIterator, _NamespaceRegistry,
2383 _ClassNamespaceRegistry, _FunctionNamespaceRegistry,
2384 _XPathFunctionNamespaceRegistry, _ParserDictionaryContext,
2385 _FileReaderContext, _ParserContext, _PythonSaxParserTarget,
2386 _TargetParserContext, _ReadOnlyProxy, _ReadOnlyPIProxy,
2387 _ReadOnlyEntityProxy, _ReadOnlyElementProxy, _OpaqueNodeWrapper,
2388 _OpaqueDocumentWrapper, _ModifyContentOnlyProxy,
2389 _ModifyContentOnlyPIProxy, _ModifyContentOnlyEntityProxy,
2390 _AppendOnlyElementProxy, _SaxParserContext, _FilelikeWriter,
2391 _ParserSchemaValidationContext, _XPathContext,
2392 _XSLTResolverContext, _XSLTContext, _XSLTQuotedStringParam``
2393
2394 * Several internal classes can no longer be inherited from:
2395 ``_InputDocument, _ResolverRegistry, _ExsltRegExp, _ElementUnicodeResult,
2396 _IterparseContext, _TempStore, _AttribIterator, _ClassNamespaceRegistry,
2397 _XPathFunctionNamespaceRegistry, _ParserDictionaryContext,
2398 _FileReaderContext, _PythonSaxParserTarget, _TargetParserContext,
2399 _ReadOnlyPIProxy, _ReadOnlyEntityProxy, _OpaqueDocumentWrapper,
2400 _ModifyContentOnlyPIProxy, _ModifyContentOnlyEntityProxy,
2401 _AppendOnlyElementProxy, _FilelikeWriter, _ParserSchemaValidationContext,
2402 _XPathContext, _XSLTResolverContext, _XSLTContext, _XSLTQuotedStringParam,
2403 _XSLTResultTree, _XSLTProcessingInstruction``
2404
2405
2406 2.3.6 (2012-09-28)
2407 ==================
2408
2409 Features added
2410 --------------
2411
2412 Bugs fixed
2413 ----------
2414
2415 * Passing long Unicode strings into the ``feed()`` parser interface
2416 failed to read the entire string.
2417
2418 Other changes
2419 --------------
2420
2421
2422 2.3.5 (2012-07-31)
2423 ==================
2424
2425 Features added
2426 --------------
2427
2428 Bugs fixed
2429 ----------
2430
2431 * Crash when merging text nodes in ``element.remove()``.
2432
2433 * Crash in sax/target parser when reporting empty doctype.
2434
2435 Other changes
2436 --------------
2437
2438
2439 2.3.4 (2012-03-26)
2440 ==================
2441
2442 Features added
2443 --------------
2444
2445 Bugs fixed
2446 ----------
2447
2448 * Crash when building an nsmap (Element property) with empty
2449 namespace URIs.
2450
2451 * Crash due to race condition when errors (or user messages) occur
2452 during threaded XSLT processing.
2453
2454 * XSLT stylesheet compilation could ignore compilation errors.
2455
2456 Other changes
2457 --------------
2458
2459
2460 2.3.3 (2012-01-04)
2461 ==================
2462
2463 Features added
2464 --------------
2465
2466 * ``lxml.html.tostring()`` gained new serialisation options
2467 ``with_tail`` and ``doctype``.
2468
2469 Bugs fixed
2470 ----------
2471
2472 * Fixed a crash when using ``iterparse()`` for HTML parsing and
2473 requesting start events.
2474
2475 * Fixed parsing of more selectors in cssselect. Whitespace before
2476 pseudo-elements and pseudo-classes is significant as it is a
2477 descendant combinator.
2478 "E :pseudo" should parse the same as "E \*:pseudo", not "E:pseudo".
2479 Patch by Simon Sapin.
2480
2481 * lxml.html.diff no longer raises an exception when hitting
2482 'img' tags without 'src' attribute.
2483
2484 Other changes
2485 --------------
2486
2487
2488 2.3.2 (2011-11-11)
2489 ==================
2490
2491 Features added
2492 --------------
2493
2494 * ``lxml.objectify.deannotate()`` has a new boolean option
2495 ``cleanup_namespaces`` to remove the objectify namespace
2496 declarations (and generally clean up the namespace declarations)
2497 after removing the type annotations.
2498
2499 * ``lxml.objectify`` gained its own ``SubElement()`` function as a
2500 copy of ``etree.SubElement`` to avoid an otherwise redundant import
2501 of ``lxml.etree`` on the user side.
2502
2503 Bugs fixed
2504 ----------
2505
2506 * Fixed the "descendant" bug in cssselect a second time (after a first
2507 fix in lxml 2.3.1). The previous change resulted in a serious
2508 performance regression for the XPath based evaluation of the
2509 translated expression. Note that this breaks the usage of some of
2510 the generated XPath expressions as XSLT location paths that
2511 previously worked in 2.3.1.
2512
2513 * Fixed parsing of some selectors in cssselect. Whitespace after combinators
2514 ">", "+" and "~" is now correctly ignored. Previously it was parsed as
2515 a descendant combinator. For example, "div> .foo" was parsed the same as
2516 "div>* .foo" instead of "div>.foo". Patch by Simon Sapin.
2517
2518 Other changes
2519 --------------
2520
2521
2522 2.3.1 (2011-09-25)
2523 ==================
2524
2525 Features added
2526 --------------
2527
2528 * New option ``kill_tags`` in ``lxml.html.clean`` to remove specific
2529 tags and their content (i.e. their whole subtree).
2530
2531 * ``pi.get()`` and ``pi.attrib`` on processing instructions to parse
2532 pseudo-attributes from the text content of processing instructions.
2533
2534 * ``lxml.get_include()`` returns a list of include paths that can be
2535 used to compile external C code against lxml.etree. This is
2536 specifically required for statically linked lxml builds when code
2537 needs to compile against the exact same header file versions as lxml
2538 itself.
2539
2540 * ``Resolver.resolve_file()`` takes an additional option
2541 ``close_file`` that configures if the file(-like) object will be
2542 closed after reading or not. By default, the file will be closed,
2543 as the user is not expected to keep a reference to it.
2544
2545 Bugs fixed
2546 ----------
2547
2548 * HTML cleaning didn't remove 'data:' links.
2549
2550 * The html5lib parser integration now uses the 'official'
2551 implementation in html5lib itself, which makes it work with newer
2552 releases of the library.
2553
2554 * In ``lxml.sax``, ``endElementNS()`` could incorrectly reject a plain
2555 tag name when the corresponding start event inferred the same plain
2556 tag name to be in the default namespace.
2557
2558 * When an open file-like object is passed into ``parse()`` or
2559 ``iterparse()``, the parser will no longer close it after use. This
2560 reverts a change in lxml 2.3 where all files would be closed. It is
2561 the user's responsibility to properly close the file(-like) object,
2562 also in error cases.
2563
2564 * Assertion error in lxml.html.cleaner when discarding top-level elements.
2565
2566 * In lxml.cssselect, use the xpath 'A//B' (short for
2567 'A/descendant-or-self::node()/B') instead of 'A/descendant::B' for
2568 the css descendant selector ('A B'). This makes a few edge cases
2569 like ``"div *:last-child"`` consistent with the selector behavior in
2570 WebKit and Firefox, and makes more css expressions valid location
2571 paths (for use in xsl:template match).
2572
2573 * In lxml.html, non-selected ``<option>`` tags no longer show up in the
2574 collected form values.
2575
2576 * Adding/removing ``<option>`` values to/from a multiple select form
2577 field properly selects them and unselects them.
2578
2579 Other changes
2580 --------------
2581
2582 * Static builds can specify the download directory with the
2583 ``--download-dir`` option.
2584
2585
2586 2.3 (2011-02-06)
2587 ================
2588
2589 Features added
2590 --------------
2591
2592 * When looking for children, ``lxml.objectify`` takes '{}tag' as
2593 meaning an empty namespace, as opposed to the parent namespace.
2594
2595 Bugs fixed
2596 ----------
2597
2598 * When finished reading from a file-like object, the parser
2599 immediately calls its ``.close()`` method.
2600
2601 * When finished parsing, ``iterparse()`` immediately closes the input
2602 file.
2603
2604 * Work-around for libxml2 bug that can leave the HTML parser in a
2605 non-functional state after parsing a severely broken document (fixed
2606 in libxml2 2.7.8).
2607
2608 * ``marque`` tag in HTML cleanup code is correctly named ``marquee``.
2609
2610 Other changes
2611 --------------
2612
2613 * Some public functions in the Cython-level C-API have more explicit
2614 return types.
2615
2616
2617 2.3beta1 (2010-09-06)
2618 =====================
2619
2620 Features added
2621 --------------
2622
2623 Bugs fixed
2624 ----------
2625
2626 * Crash in newer libxml2 versions when moving elements between
2627 documents that had attributes on replaced XInclude nodes.
2628
2629 * ``XMLID()`` function was missing the optional ``parser`` and
2630 ``base_url`` parameters.
2631
2632 * Searching for wildcard tags in ``iterparse()`` was broken in Py3.
2633
2634 * ``lxml.html.open_in_browser()`` didn't work in Python 3 due to the
2635 use of os.tempnam. It now takes an optional 'encoding' parameter.
2636
2637 Other changes
2638 --------------
2639
2640
2641 2.3alpha2 (2010-07-24)
2642 ======================
2643
2644 Features added
2645 --------------
2646
2647 Bugs fixed
2648 ----------
2649
2650 * Crash in XSLT when generating text-only result documents with a
2651 stylesheet created in a different thread.
2652
2653 Other changes
2654 --------------
2655
2656 * ``repr()`` of Element objects shows the hex ID with leading 0x
2657 (following ElementTree 1.3).
2658
2659
2660 2.3alpha1 (2010-06-19)
2661 ======================
2662
2663 Features added
2664 --------------
2665
2666 * Keyword argument ``namespaces`` in ``lxml.cssselect.CSSSelector()``
2667 to pass a prefix-to-namespace mapping for the selector.
2668
2669 * New function ``lxml.etree.register_namespace(prefix, uri)`` that
2670 globally registers a namespace prefix for a namespace that newly
2671 created Elements in that namespace will use automatically. Follows
2672 ElementTree 1.3.
2673
2674 * Support 'unicode' string name as encoding parameter in
2675 ``tostring()``, following ElementTree 1.3.
2676
2677 * Support 'c14n' serialisation method in ``ElementTree.write()`` and
2678 ``tostring()``, following ElementTree 1.3.
2679
2680 * The ElementPath expression syntax (``el.find*()``) was extended to
2681 match the upcoming ElementTree 1.3 that will ship in the standard
2682 library of Python 3.2/2.7. This includes extended support for
2683 predicates as well as namespace prefixes (as known from XPath).
2684
2685 * During regular XPath evaluation, various ESXLT functions are
2686 available within their namespace when using libxslt 1.1.26 or later.
2687
2688 * Support passing a readily configured logger instance into
2689 ``PyErrorLog``, instead of a logger name.
2690
2691 * On serialisation, the new ``doctype`` parameter can be used to
2692 override the DOCTYPE (internal subset) of the document.
2693
2694 * New parameter ``output_parent`` to ``XSLTExtension.apply_templates()``
2695 to append the resulting content directly to an output element.
2696
2697 * ``XSLTExtension.process_children()`` to process the content of the
2698 XSLT extension element itself.
2699
2700 * ISO-Schematron support based on the de-facto Schematron reference
2701 'skeleton implementation'.
2702
2703 * XSLT objects now take XPath object as ``__call__`` stylesheet
2704 parameters.
2705
2706 * Enable path caching in ElementPath (``el.find*()``) to avoid parsing
2707 overhead.
2708
2709 * Setting the value of a namespaced attribute always uses a prefixed
2710 namespace instead of the default namespace even if both declare the
2711 same namespace URI. This avoids serialisation problems when an
2712 attribute from a default namespace is set on an element from a
2713 different namespace.
2714
2715 * XSLT extension elements: support for XSLT context nodes other than
2716 elements: document root, comments, processing instructions.
2717
2718 * Support for strings (in addition to Elements) in node-sets returned
2719 by extension functions.
2720
2721 * Forms that lack an ``action`` attribute default to the base URL of
2722 the document on submit.
2723
2724 * XPath attribute result strings have an ``attrname`` property.
2725
2726 * Namespace URIs get validated against RFC 3986 at the API level
2727 (required by the XML namespace specification).
2728
2729 * Target parsers show their target object in the ``.target`` property
2730 (compatible with ElementTree).
2731
2732 Bugs fixed
2733 ----------
2734
2735 * API is hardened against invalid proxy instances to prevent crashes
2736 due to incorrectly instantiated Element instances.
2737
2738 * Prevent crash when instantiating ``CommentBase`` and friends.
2739
2740 * Export ElementTree compatible XML parser class as
2741 ``XMLTreeBuilder``, as it is called in ET 1.2.
2742
2743 * ObjectifiedDataElements in lxml.objectify were not hashable. They
2744 now use the hash value of the underlying Python value (string,
2745 number, etc.) to which they compare equal.
2746
2747 * Parsing broken fragments in lxml.html could fail if the fragment
2748 contained an orphaned closing '</div>' tag.
2749
2750 * Using XSLT extension elements around the root of the output document
2751 crashed.
2752
2753 * ``lxml.cssselect`` did not distinguish between ``x[attr="val"]`` and
2754 ``x [attr="val"]`` (with a space). The latter now matches the
2755 attribute independent of the element.
2756
2757 * Rewriting multiple links inside of HTML text content could end up
2758 replacing unrelated content as replacements could impact the
2759 reported position of subsequent matches. Modifications are now
2760 simplified by letting the ``iterlinks()`` generator in ``lxml.html``
2761 return links in reversed order if they appear inside the same text
2762 node. Thus, replacements and link-internal modifications no longer
2763 change the position of links reported afterwards.
2764
2765 * The ``.value`` attribute of ``textarea`` elements in lxml.html did
2766 not represent the complete raw value (including child tags etc.). It
2767 now serialises the complete content on read and replaces the
2768 complete content by a string on write.
2769
2770 * Target parser didn't call ``.close()`` on the target object if
2771 parsing failed. Now it is guaranteed that ``.close()`` will be
2772 called after parsing, regardless of the outcome.
2773
2774 Other changes
2775 -------------
2776
2777 * Official support for Python 3.1.2 and later.
2778
2779 * Static MS Windows builds can now download their dependencies
2780 themselves.
2781
2782 * ``Element.attrib`` no longer uses a cyclic reference back to its
2783 Element object. It therefore no longer requires the garbage
2784 collector to clean up.
2785
2786 * Static builds include libiconv, in addition to libxml2 and libxslt.
2787
2788
2789 2.2.8 (2010-09-02)
2790 ==================
2791
2792 Bugs fixed
2793 ----------
2794
2795 * Crash in newer libxml2 versions when moving elements between
2796 documents that had attributes on replaced XInclude nodes.
2797
2798 * Import fix for urljoin in Python 3.1+.
2799
2800
2801 2.2.7 (2010-07-24)
2802 ==================
2803
2804 Bugs fixed
2805 ----------
2806
2807 * Crash in XSLT when generating text-only result documents with a
2808 stylesheet created in a different thread.
2809
2810
2811 2.2.6 (2010-03-02)
2812 ==================
2813
2814 Bugs fixed
2815 ----------
2816
2817 * Fixed several Python 3 regressions by building with Cython 0.11.3.
2818
2819
2820 2.2.5 (2010-02-28)
2821 ==================
2822
2823 Features added
2824 --------------
2825
2826 * Support for running XSLT extension elements on the input root node
2827 (e.g. in a template matching on "/").
2828
2829 Bugs fixed
2830 ----------
2831
2832 * Crash in XPath evaluation when reading smart strings from a document
2833 other than the original context document.
2834
2835 * Support recent versions of html5lib by not requiring its
2836 ``XHTMLParser`` in ``htmlparser.py`` anymore.
2837
2838 * Manually instantiating the custom element classes in
2839 ``lxml.objectify`` could crash.
2840
2841 * Invalid XML text characters were not rejected by the API when they
2842 appeared in unicode strings directly after non-ASCII characters.
2843
2844 * lxml.html.open_http_urllib() did not work in Python 3.
2845
2846 * The functions ``strip_tags()`` and ``strip_elements()`` in
2847 ``lxml.etree`` did not remove all occurrences of a tag in all cases.
2848
2849 * Crash in XSLT extension elements when the XSLT context node is not
2850 an element.
2851
2852
2853 2.2.4 (2009-11-11)
2854 ==================
2855
2856 Bugs fixed
2857 ----------
2858
2859 * Static build of libxml2/libxslt was broken.
2860
2861
2862 2.2.3 (2009-10-30)
2863 ==================
2864
2865 Features added
2866 --------------
2867
2868 Bugs fixed
2869 ----------
2870
2871 * The ``resolve_entities`` option did not work in the incremental feed
2872 parser.
2873
2874 * Looking up and deleting attributes without a namespace could hit a
2875 namespaced attribute of the same name instead.
2876
2877 * Late errors during calls to ``SubElement()`` (e.g. attribute related
2878 ones) could leave a partially initialised element in the tree.
2879
2880 * Modifying trees that contain parsed entity references could result
2881 in an infinite loop.
2882
2883 * ObjectifiedElement.__setattr__ created an empty-string child element when the
2884 attribute value was rejected as a non-unicode/non-ascii string
2885
2886 * Syntax errors in ``lxml.cssselect`` could result in misleading error
2887 messages.
2888
2889 * Invalid syntax in CSS expressions could lead to an infinite loop in
2890 the parser of ``lxml.cssselect``.
2891
2892 * CSS special character escapes were not properly handled in
2893 ``lxml.cssselect``.
2894
2895 * CSS Unicode escapes were not properly decoded in ``lxml.cssselect``.
2896
2897 * Select options in HTML forms that had no explicit ``value``
2898 attribute were not handled correctly. The HTML standard dictates
2899 that their value is defined by their text content. This is now
2900 supported by lxml.html.
2901
2902 * XPath raised a TypeError when finding CDATA sections. This is now
2903 fully supported.
2904
2905 * Calling ``help(lxml.objectify)`` didn't work at the prompt.
2906
2907 * The ``ElementMaker`` in lxml.objectify no longer defines the default
2908 namespaces when annotation is disabled.
2909
2910 * Feed parser failed to honour the 'recover' option on parse errors.
2911
2912 * Diverting the error logging to Python's logging system was broken.
2913
2914 Other changes
2915 -------------
2916
2917
2918 2.2.2 (2009-06-21)
2919 ==================
2920
2921 Features added
2922 --------------
2923
2924 * New helper functions ``strip_attributes()``, ``strip_elements()``,
2925 ``strip_tags()`` in lxml.etree to remove attributes/subtrees/tags
2926 from a subtree.
2927
2928 Bugs fixed
2929 ----------
2930
2931 * Namespace cleanup on subtree insertions could result in missing
2932 namespace declarations (and potentially crashes) if the element
2933 defining a namespace was deleted and the namespace was not used by
2934 the top element of the inserted subtree but only in deeper subtrees.
2935
2936 * Raising an exception from a parser target callback didn't always
2937 terminate the parser.
2938
2939 * Only {true, false, 1, 0} are accepted as the lexical representation for
2940 BoolElement ({True, False, T, F, t, f} not any more), restoring lxml <= 2.0
2941 behaviour.
2942
2943 Other changes
2944 -------------
2945
2946
2947 2.2.1 (2009-06-02)
2948 ==================
2949
2950 Features added
2951 --------------
2952
2953 * Injecting default attributes into a document during XML Schema
2954 validation (also at parse time).
2955
2956 * Pass ``huge_tree`` parser option to disable parser security
2957 restrictions imposed by libxml2 2.7.
2958
2959 Bugs fixed
2960 ----------
2961
2962 * The script for statically building libxml2 and libxslt didn't work
2963 in Py3.
2964
2965 * ``XMLSchema()`` also passes invalid schema documents on to libxml2
2966 for parsing (which could lead to a crash before release 2.6.24).
2967
2968 Other changes
2969 -------------
2970
2971
2972 2.2 (2009-03-21)
2973 ================
2974
2975 Features added
2976 --------------
2977
2978 * Support for ``standalone`` flag in XML declaration through
2979 ``tree.docinfo.standalone`` and by passing ``standalone=True/False``
2980 on serialisation.
2981
2982 Bugs fixed
2983 ----------
2984
2985 * Crash when parsing an XML Schema with external imports from a
2986 filename.
2987
2988
2989 2.2beta4 (2009-02-27)
2990 =====================
2991
2992 Features added
2993 --------------
2994
2995 * Support strings and instantiable Element classes as child arguments
2996 to the constructor of custom Element classes.
2997
2998 * GZip compression support for serialisation to files and file-like
2999 objects.
3000
3001 Bugs fixed
3002 ----------
3003
3004 * Deep-copying an ElementTree copied neither its sibling PIs and
3005 comments nor its internal/external DTD subsets.
3006
3007 * Soupparser failed on broken attributes without values.
3008
3009 * Crash in XSLT when overwriting an already defined attribute using
3010 ``xsl:attribute``.
3011
3012 * Crash bug in exception handling code under Python 3. This was due
3013 to a problem in Cython, not lxml itself.
3014
3015 * ``lxml.html.FormElement._name()`` failed for non top-level forms.
3016
3017 * ``TAG`` special attribute in constructor of custom Element classes
3018 was evaluated incorrectly.
3019
3020 Other changes
3021 -------------
3022
3023 * Official support for Python 3.0.1.
3024
3025 * ``Element.findtext()`` now returns an empty string instead of None
3026 for Elements without text content.
3027
3028
3029 2.2beta3 (2009-02-17)
3030 =====================
3031
3032 Features added
3033 --------------
3034
3035 * ``XSLT.strparam()`` class method to wrap quoted string parameters
3036 that require escaping.
3037
3038 Bugs fixed
3039 ----------
3040
3041 * Memory leak in XPath evaluators.
3042
3043 * Crash when parsing indented XML in one thread and merging it with
3044 other documents parsed in another thread.
3045
3046 * Setting the ``base`` attribute in ``lxml.objectify`` from a unicode
3047 string failed.
3048
3049 * Fixes following changes in Python 3.0.1.
3050
3051 * Minor fixes for Python 3.
3052
3053 Other changes
3054 -------------
3055
3056 * The global error log (which is copied into the exception log) is now
3057 local to a thread, which fixes some race conditions.
3058
3059 * More robust error handling on serialisation.
3060
3061
3062 2.2beta2 (2009-01-25)
3063 =====================
3064
3065 Bugs fixed
3066 ----------
3067
3068 * Potential memory leak on exception handling. This was due to a
3069 problem in Cython, not lxml itself.
3070
3071 * ``iter_links`` (and related link-rewriting functions) in
3072 ``lxml.html`` would interpret CSS like ``url("link")`` incorrectly
3073 (treating the quotation marks as part of the link).
3074
3075 * Failing import on systems that have an ``io`` module.
3076
3077
3078 2.1.5 (2009-01-06)
3079 ==================
3080
3081 Bugs fixed
3082 ----------
3083
3084 * Potential memory leak on exception handling. This was due to a
3085 problem in Cython, not lxml itself.
3086
3087 * Failing import on systems that have an ``io`` module.
3088
3089
3090 2.2beta1 (2008-12-12)
3091 =====================
3092
3093 Features added
3094 --------------
3095
3096 * Allow ``lxml.html.diff.htmldiff`` to accept Element objects, not
3097 just HTML strings.
3098
3099 Bugs fixed
3100 ----------
3101
3102 * Crash when using an XPath evaluator in multiple threads.
3103
3104 * Fixed missing whitespace before ``Link:...`` in ``lxml.html.diff``.
3105
3106 Other changes
3107 -------------
3108
3109 * Export ``lxml.html.parse``.
3110
3111
3112 2.1.4 (2008-12-12)
3113 ==================
3114
3115 Bugs fixed
3116 ----------
3117
3118 * Crash when using an XPath evaluator in multiple threads.
3119
3120
3121 2.0.11 (2008-12-12)
3122 ===================
3123
3124 Bugs fixed
3125 ----------
3126
3127 * Crash when using an XPath evaluator in multiple threads.
3128
3129
3130 2.2alpha1 (2008-11-23)
3131 ======================
3132
3133 Features added
3134 --------------
3135
3136 * Support for XSLT result tree fragments in XPath/XSLT extension
3137 functions.
3138
3139 * QName objects have new properties ``namespace`` and ``localname``.
3140
3141 * New options for exclusive C14N and C14N without comments.
3142
3143 * Instantiating a custom Element classes creates a new Element.
3144
3145 Bugs fixed
3146 ----------
3147
3148 * XSLT didn't inherit the parse options of the input document.
3149
3150 * 0-bytes could slip through the API when used inside of Unicode
3151 strings.
3152
3153 * With ``lxml.html.clean.autolink``, links with balanced parenthesis,
3154 that end in a parenthesis, will be linked in their entirety (typical
3155 with Wikipedia links).
3156
3157 Other changes
3158 -------------
3159
3160
3161 2.1.3 (2008-11-17)
3162 ==================
3163
3164 Features added
3165 --------------
3166
3167 Bugs fixed
3168 ----------
3169
3170 * Ref-count leaks when lxml enters a try-except statement while an
3171 outside exception lives in sys.exc_*(). This was due to a problem in
3172 Cython, not lxml itself.
3173
3174 * Parser Unicode decoding errors could get swallowed by other
3175 exceptions.
3176
3177 * Name/import errors in some Python modules.
3178
3179 * Internal DTD subsets that did not specify a system or public ID were
3180 not serialised and did not appear in the docinfo property of
3181 ElementTrees.
3182
3183 * Fix a pre-Py3k warning when parsing from a gzip file in Py2.6.
3184
3185 * Test suite fixes for libxml2 2.7.
3186
3187 * Resolver.resolve_string() did not work for non-ASCII byte strings.
3188
3189 * Resolver.resolve_file() was broken.
3190
3191 * Overriding the parser encoding didn't work for many encodings.
3192
3193 Other changes
3194 -------------
3195
3196
3197 2.0.10 (2008-11-17)
3198 ===================
3199
3200 Bugs fixed
3201 ----------
3202
3203 * Ref-count leaks when lxml enters a try-except statement while an
3204 outside exception lives in sys.exc_*(). This was due to a problem in
3205 Cython, not lxml itself.
3206
3207
3208 2.1.2 (2008-09-05)
3209 ==================
3210
3211 Features added
3212 --------------
3213
3214 * lxml.etree now tries to find the absolute path name of files when
3215 parsing from a file-like object. This helps custom resolvers when
3216 resolving relative URLs, as libxml2 can prepend them with the path
3217 of the source document.
3218
3219 Bugs fixed
3220 ----------
3221
3222 * Memory problem when passing documents between threads.
3223
3224 * Target parser did not honour the ``recover`` option and raised an
3225 exception instead of calling ``.close()`` on the target.
3226
3227 Other changes
3228 -------------
3229
3230
3231 2.0.9 (2008-09-05)
3232 ==================
3233
3234 Bugs fixed
3235 ----------
3236
3237 * Memory problem when passing documents between threads.
3238
3239 * Target parser did not honour the ``recover`` option and raised an
3240 exception instead of calling ``.close()`` on the target.
3241
3242
3243 2.1.1 (2008-07-24)
3244 ==================
3245
3246 Features added
3247 --------------
3248
3249 Bugs fixed
3250 ----------
3251
3252 * Crash when parsing XSLT stylesheets in a thread and using them in
3253 another.
3254
3255 * Encoding problem when including text with ElementInclude under
3256 Python 3.
3257
3258 Other changes
3259 -------------
3260
3261
3262 2.0.8 (2008-07-24)
3263 ==================
3264
3265 Features added
3266 --------------
3267
3268 * ``lxml.html.rewrite_links()`` strips links to work around documents
3269 with whitespace in URL attributes.
3270
3271 Bugs fixed
3272 ----------
3273
3274 * Crash when parsing XSLT stylesheets in a thread and using them in
3275 another.
3276
3277 * CSS selector parser dropped remaining expression after a function
3278 with parameters.
3279
3280 Other changes
3281 -------------
3282
3283
3284 2.1 (2008-07-09)
3285 ================
3286
3287 Features added
3288 --------------
3289
3290 * Smart strings can be switched off in XPath (``smart_strings``
3291 keyword option).
3292
3293 * ``lxml.html.rewrite_links()`` strips links to work around documents
3294 with whitespace in URL attributes.
3295
3296 Bugs fixed
3297 ----------
3298
3299 * Custom resolvers were not used for XMLSchema includes/imports and
3300 XInclude processing.
3301
3302 * CSS selector parser dropped remaining expression after a function
3303 with parameters.
3304
3305 Other changes
3306 -------------
3307
3308 * ``objectify.enableRecursiveStr()`` was removed, use
3309 ``objectify.enable_recursive_str()`` instead
3310
3311 * Speed-up when running XSLTs on documents from other threads
3312
3313
3314 2.0.7 (2008-06-20)
3315 ==================
3316
3317 Features added
3318 --------------
3319
3320 * Pickling ``ElementTree`` objects in lxml.objectify.
3321
3322 Bugs fixed
3323 ----------
3324
3325 * Descending dot-separated classes in CSS selectors were not resolved
3326 correctly.
3327
3328 * ``ElementTree.parse()`` didn't handle target parser result.
3329
3330 * Potential threading problem in XInclude.
3331
3332 * Crash in Element class lookup classes when the __init__() method of
3333 the super class is not called from Python subclasses.
3334
3335 Other changes
3336 -------------
3337
3338 * Non-ASCII characters in attribute values are no longer escaped on
3339 serialisation.
3340
3341
3342 2.1beta3 (2008-06-19)
3343 =====================
3344
3345 Features added
3346 --------------
3347
3348 * Major overhaul of ``tools/xpathgrep.py`` script.
3349
3350 * Pickling ``ElementTree`` objects in lxml.objectify.
3351
3352 * Support for parsing from file-like objects that return unicode
3353 strings.
3354
3355 * New function ``etree.cleanup_namespaces(el)`` that removes unused
3356 namespace declarations from a (sub)tree (experimental).
3357
3358 * XSLT results support the buffer protocol in Python 3.
3359
3360 * Polymorphic functions in ``lxml.html`` that accept either a tree or
3361 a parsable string will return either a UTF-8 encoded byte string, a
3362 unicode string or a tree, based on the type of the input.
3363 Previously, the result was always a byte string or a tree.
3364
3365 * Support for Python 2.6 and 3.0 beta.
3366
3367 * File name handling now uses a heuristic to convert between byte
3368 strings (usually filenames) and unicode strings (usually URLs).
3369
3370 * Parsing from a plain file object frees the GIL under Python 2.x.
3371
3372 * Running ``iterparse()`` on a plain file (or filename) frees the GIL
3373 on reading under Python 2.x.
3374
3375 * Conversion functions ``html_to_xhtml()`` and ``xhtml_to_html()`` in
3376 lxml.html (experimental).
3377
3378 * Most features in lxml.html work for XHTML namespaced tag names
3379 (experimental).
3380
3381 Bugs fixed
3382 ----------
3383
3384 * ``ElementTree.parse()`` didn't handle target parser result.
3385
3386 * Crash in Element class lookup classes when the __init__() method of
3387 the super class is not called from Python subclasses.
3388
3389 * A number of problems related to unicode/byte string conversion of
3390 filenames and error messages were fixed.
3391
3392 * Building on MacOS-X now passes the "flat_namespace" option to the C
3393 compiler, which reportedly prevents build quirks and crashes on this
3394 platform.
3395
3396 * Windows build was broken.
3397
3398 * Rare crash when serialising to a file object with certain encodings.
3399
3400 Other changes
3401 -------------
3402
3403 * Non-ASCII characters in attribute values are no longer escaped on
3404 serialisation.
3405
3406 * Passing non-ASCII byte strings or invalid unicode strings as .tag,
3407 namespaces, etc. will result in a ValueError instead of an
3408 AssertionError (just like the tag well-formedness check).
3409
3410 * Up to several times faster attribute access (i.e. tree traversal) in
3411 lxml.objectify.
3412
3413
3414 2.0.6 (2008-05-31)
3415 ==================
3416
3417 Features added
3418 --------------
3419
3420 Bugs fixed
3421 ----------
3422
3423 * Incorrect evaluation of ``el.find("tag[child]")``.
3424
3425 * Windows build was broken.
3426
3427 * Moving a subtree from a document created in one thread into a
3428 document of another thread could crash when the rest of the source
3429 document is deleted while the subtree is still in use.
3430
3431 * Rare crash when serialising to a file object with certain encodings.
3432
3433 Other changes
3434 -------------
3435
3436 * lxml should now build without problems on MacOS-X.
3437
3438
3439 2.1beta2 (2008-05-02)
3440 =====================
3441
3442 Features added
3443 --------------
3444
3445 * All parse functions in lxml.html take a ``parser`` keyword argument.
3446
3447 * lxml.html has a new parser class ``XHTMLParser`` and a module
3448 attribute ``xhtml_parser`` that provide XML parsers that are
3449 pre-configured for the lxml.html package.
3450
3451 Bugs fixed
3452 ----------
3453
3454 * Moving a subtree from a document created in one thread into a
3455 document of another thread could crash when the rest of the source
3456 document is deleted while the subtree is still in use.
3457
3458 * Passing an nsmap when creating an Element will no longer strip
3459 redundantly defined namespace URIs. This prevented the definition
3460 of more than one prefix for a namespace on the same Element.
3461
3462 Other changes
3463 -------------
3464
3465 * If the default namespace is redundantly defined with a prefix on the
3466 same Element, the prefix will now be preferred for subelements and
3467 attributes. This allows users to work around a problem in libxml2
3468 where attributes from the default namespace could serialise without
3469 a prefix even when they appear on an Element with a different
3470 namespace (i.e. they would end up in the wrong namespace).
3471
3472
3473 2.0.5 (2008-05-01)
3474 ==================
3475
3476 Features added
3477 --------------
3478
3479 Bugs fixed
3480 ----------
3481
3482 * Resolving to a filename in custom resolvers didn't work.
3483
3484 * lxml did not honour libxslt's second error state "STOPPED", which
3485 let some XSLT errors pass silently.
3486
3487 * Memory leak in Schematron with libxml2 >= 2.6.31.
3488
3489 Other changes
3490 -------------
3491
3492
3493 2.1beta1 (2008-04-15)
3494 =====================
3495
3496 Features added
3497 --------------
3498
3499 * Error logging in Schematron (requires libxml2 2.6.32 or later).
3500
3501 * Parser option ``strip_cdata`` for normalising or keeping CDATA
3502 sections. Defaults to ``True`` as before, thus replacing CDATA
3503 sections by their text content.
3504
3505 * ``CDATA()`` factory to wrap string content as CDATA section.
3506
3507 Bugs fixed
3508 ----------
3509
3510 * Resolving to a filename in custom resolvers didn't work.
3511
3512 * lxml did not honour libxslt's second error state "STOPPED", which
3513 let some XSLT errors pass silently.
3514
3515 * Memory leak in Schematron with libxml2 >= 2.6.31.
3516
3517 * lxml.etree accepted non well-formed namespace prefix names.
3518
3519 Other changes
3520 -------------
3521
3522 * Major cleanup in internal ``moveNodeToDocument()`` function, which
3523 takes care of namespace cleanup when moving elements between
3524 different namespace contexts.
3525
3526 * New Elements created through the ``makeelement()`` method of an HTML
3527 parser or through lxml.html now end up in a new HTML document
3528 (doctype HTML 4.01 Transitional) instead of a generic XML document.
3529 This mostly impacts the serialisation and the availability of a DTD
3530 context.
3531
3532
3533 2.0.4 (2008-04-13)
3534 ==================
3535
3536 Features added
3537 --------------
3538
3539 Bugs fixed
3540 ----------
3541
3542 * Hanging thread in conjunction with GTK threading.
3543
3544 * Crash bug in iterparse when moving elements into other documents.
3545
3546 * HTML elements' ``.cssselect()`` method was broken.
3547
3548 * ``ElementTree.find*()`` didn't accept QName objects.
3549
3550 Other changes
3551 -------------
3552
3553
3554 2.1alpha1 (2008-03-27)
3555 ======================
3556
3557 Features added
3558 --------------
3559
3560 * New event types 'comment' and 'pi' in ``iterparse()``.
3561
3562 * ``XSLTAccessControl`` instances have a property ``options`` that
3563 returns a dict of access configuration options.
3564
3565 * Constant instances ``DENY_ALL`` and ``DENY_WRITE`` on
3566 ``XSLTAccessControl`` class.
3567
3568 * Extension elements for XSLT (experimental!)
3569
3570 * ``Element.base`` property returns the xml:base or HTML base URL of
3571 an Element.
3572
3573 * ``docinfo.URL`` property is writable.
3574
3575 Bugs fixed
3576 ----------
3577
3578 * Default encoding for plain text serialisation was different from
3579 that of XML serialisation (UTF-8 instead of ASCII).
3580
3581 Other changes
3582 -------------
3583
3584 * Minor API speed-ups.
3585
3586 * The benchmark suite now uses tail text in the trees, which makes the
3587 absolute numbers incomparable to previous results.
3588
3589 * Generating the HTML documentation now requires Pygments_, which is
3590 used to enable syntax highlighting for the doctest examples.
3591
3592 .. _Pygments: http://pygments.org/
3593
3594 Most long-time deprecated functions and methods were removed:
3595
3596 - ``etree.clearErrorLog()``, use ``etree.clear_error_log()``
3597
3598 - ``etree.useGlobalPythonLog()``, use
3599 ``etree.use_global_python_log()``
3600
3601 - ``etree.ElementClassLookup.setFallback()``, use
3602 ``etree.ElementClassLookup.set_fallback()``
3603
3604 - ``etree.getDefaultParser()``, use ``etree.get_default_parser()``
3605
3606 - ``etree.setDefaultParser()``, use ``etree.set_default_parser()``
3607
3608 - ``etree.setElementClassLookup()``, use
3609 ``etree.set_element_class_lookup()``
3610
3611 Note that ``parser.setElementClassLookup()`` has not been removed
3612 yet, although ``parser.set_element_class_lookup()`` should be used
3613 instead.
3614
3615 - ``xpath_evaluator.registerNamespace()``, use
3616 ``xpath_evaluator.register_namespace()``
3617
3618 - ``xpath_evaluator.registerNamespaces()``, use
3619 ``xpath_evaluator.register_namespaces()``
3620
3621 - ``objectify.setPytypeAttributeTag``, use
3622 ``objectify.set_pytype_attribute_tag``
3623
3624 - ``objectify.setDefaultParser()``, use
3625 ``objectify.set_default_parser()``
3626
3627
3628 2.0.3 (2008-03-26)
3629 ==================
3630
3631 Features added
3632 --------------
3633
3634 * soupparser.parse() allows passing keyword arguments on to
3635 BeautifulSoup.
3636
3637 * ``fromstring()`` method in ``lxml.html.soupparser``.
3638
3639 Bugs fixed
3640 ----------
3641
3642 * ``lxml.html.diff`` didn't treat empty tags properly (e.g.,
3643 ``<br>``).
3644
3645 * Handle entity replacements correctly in target parser.
3646
3647 * Crash when using ``iterparse()`` with XML Schema validation.
3648
3649 * The BeautifulSoup parser (soupparser.py) did not replace entities,
3650 which made them turn up in text content.
3651
3652 * Attribute assignment of custom PyTypes in objectify could fail to
3653 correctly serialise the value to a string.
3654
3655 Other changes
3656 -------------
3657
3658 * ``lxml.html.ElementSoup`` was replaced by a new module
3659 ``lxml.html.soupparser`` with a more consistent API. The old module
3660 remains for compatibility with ElementTree's own ElementSoup module.
3661
3662 * Setting the XSLT_CONFIG and XML2_CONFIG environment variables at
3663 build time will let setup.py pick up the ``xml2-config`` and
3664 ``xslt-config`` scripts from the supplied path name.
3665
3666 * Passing ``--with-xml2-config=/path/to/xml2-config`` to setup.py will
3667 override the ``xml2-config`` script that is used to determine the C
3668 compiler options. The same applies for the ``--with-xslt-config``
3669 option.
3670
3671
3672 2.0.2 (2008-02-22)
3673 ==================
3674
3675 Features added
3676 --------------
3677
3678 * Support passing ``base_url`` to file parser functions to override
3679 the filename of the file(-like) object.
3680
3681 Bugs fixed
3682 ----------
3683
3684 * The prefix for objectify's pytype namespace was missing from the set
3685 of default prefixes.
3686
3687 * Memory leak in Schematron (fixed only for libxml2 2.6.31+).
3688
3689 * Error type names in RelaxNG were reported incorrectly.
3690
3691 * Slice deletion bug fixed in objectify.
3692
3693 Other changes
3694 -------------
3695
3696 * Enabled doctests for some Python modules (especially ``lxml.html``).
3697
3698 * Add a ``method`` argument to ``lxml.html.tostring()``
3699 (``method="xml"`` for XHTML output).
3700
3701 * Make it clearer that methods like ``lxml.html.fromstring()`` take a
3702 ``base_url`` argument.
3703
3704
3705 2.0.1 (2008-02-13)
3706 ==================
3707
3708 Features added
3709 --------------
3710
3711 * Child iteration in ``lxml.pyclasslookup``.
3712
3713 * Loads of new docstrings reflect the signature of functions and
3714 methods to make them visible in API docs and ``help()``
3715
3716 Bugs fixed
3717 ----------
3718
3719 * The module ``lxml.html.builder`` was duplicated as
3720 ``lxml.htmlbuilder``
3721
3722 * Form elements would return None for ``form.fields.keys()`` if there
3723 was an unnamed input field. Now unnamed input fields are completely
3724 ignored.
3725
3726 * Setting an element slice in objectify could insert slice-overlapping
3727 elements at the wrong position.
3728
3729 Other changes
3730 -------------
3731
3732 * The generated API documentation was cleaned up and disburdened from
3733 non-public classes etc.
3734
3735 * The previously public module ``lxml.html.setmixin`` was renamed to
3736 ``lxml.html._setmixin`` as it is not an official part of lxml. If
3737 you want to use it, feel free to copy it over to your own source
3738 base.
3739
3740 * Passing ``--with-xslt-config=/path/to/xslt-config`` to setup.py will
3741 override the ``xslt-config`` script that is used to determine the C
3742 compiler options.
3743
3744
3745 2.0 (2008-02-01)
3746 ================
3747
3748 Features added
3749 --------------
3750
3751 * Passing the ``unicode`` type as ``encoding`` to ``tostring()`` will
3752 serialise to unicode. The ``tounicode()`` function is now
3753 deprecated.
3754
3755 * ``XMLSchema()`` and ``RelaxNG()`` can parse from StringIO.
3756
3757 * ``makeparser()`` function in ``lxml.objectify`` to create a new
3758 parser with the usual objectify setup.
3759
3760 * Plain ASCII XPath string results are no longer forced into unicode
3761 objects as in 2.0beta1, but are returned as plain strings as before.
3762
3763 * All XPath string results are 'smart' objects that have a
3764 ``getparent()`` method to retrieve their parent Element.
3765
3766 * ``with_tail`` option in serialiser functions.
3767
3768 * More accurate exception messages in validator creation.
3769
3770 * Parse-time XML schema validation (``schema`` parser keyword).
3771
3772 * XPath string results of the ``text()`` function and attribute
3773 selection make their Element container accessible through a
3774 ``getparent()`` method. As a side-effect, they are now always
3775 unicode objects (even ASCII strings).
3776
3777 * ``XSLT`` objects are usable in any thread - at the cost of a deep
3778 copy if they were not created in that thread.
3779
3780 * Invalid entity names and character references will be rejected by
3781 the ``Entity()`` factory.
3782
3783 * ``entity.text`` returns the textual representation of the entity,
3784 e.g. ``&amp;``.
3785
3786 * New properties ``position`` and ``code`` on ParseError exception (as
3787 in ET 1.3)
3788
3789 * Rich comparison of ``element.attrib`` proxies.
3790
3791 * ElementTree compatible TreeBuilder class.
3792
3793 * Use default prefixes for some common XML namespaces.
3794
3795 * ``lxml.html.clean.Cleaner`` now allows for a ``host_whitelist``, and
3796 two overridable methods: ``allow_embedded_url(el, url)`` and the
3797 more general ``allow_element(el)``.
3798
3799 * Extended slicing of Elements as in ``element[1:-1:2]``, both in
3800 etree and in objectify
3801
3802 * Resolvers can now provide a ``base_url`` keyword argument when
3803 resolving a document as string data.
3804
3805 * When using ``lxml.doctestcompare`` you can give the doctest option
3806 ``NOPARSE_MARKUP`` (like ``# doctest: +NOPARSE_MARKUP``) to suppress
3807 the special checking for one test.
3808
3809 * Separate ``feed_error_log`` property for the feed parser interface.
3810 The normal parser interface and ``iterparse`` continue to use
3811 ``error_log``.
3812
3813 * The normal parsers and the feed parser interface are now separated
3814 and can be used concurrently on the same parser instance.
3815
3816 * ``fromstringlist()`` and ``tostringlist()`` functions as in
3817 ElementTree 1.3
3818
3819 * ``iterparse()`` accepts an ``html`` boolean keyword argument for
3820 parsing with the HTML parser (note that this interface may be
3821 subject to change)
3822
3823 * Parsers accept an ``encoding`` keyword argument that overrides the encoding
3824 of the parsed documents.
3825
3826 * New C-API function ``hasChild()`` to test for children
3827
3828 * ``annotate()`` function in objectify can annotate with Python types and XSI
3829 types in one step. Accompanied by ``xsiannotate()`` and ``pyannotate()``.
3830
3831 * ``ET.write()``, ``tostring()`` and ``tounicode()`` now accept a keyword
3832 argument ``method`` that can be one of 'xml' (or None), 'html' or 'text' to
3833 serialise as XML, HTML or plain text content.
3834
3835 * ``iterfind()`` method on Elements returns an iterator equivalent to
3836 ``findall()``
3837
3838 * ``itertext()`` method on Elements
3839
3840 * Setting a QName object as value of the .text property or as an attribute
3841 will resolve its prefix in the respective context
3842
3843 * ElementTree-like parser target interface as described in
3844 http://effbot.org/elementtree/elementtree-xmlparser.htm
3845
3846 * ElementTree-like feed parser interface on XMLParser and HTMLParser
3847 (``feed()`` and ``close()`` methods)
3848
3849 * Reimplemented ``objectify.E`` for better performance and improved
3850 integration with objectify. Provides extended type support based on
3851 registered PyTypes.
3852
3853 * XSLT objects now support deep copying
3854
3855 * New ``makeSubElement()`` C-API function that allows creating a new
3856 subelement straight with text, tail and attributes.
3857
3858 * XPath extension functions can now access the current context node
3859 (``context.context_node``) and use a context dictionary
3860 (``context.eval_context``) from the context provided in their first
3861 parameter
3862
3863 * HTML tag soup parser based on BeautifulSoup in ``lxml.html.ElementSoup``
3864
3865 * New module ``lxml.doctestcompare`` by Ian Bicking for writing simplified
3866 doctests based on XML/HTML output. Use by importing ``lxml.usedoctest`` or
3867 ``lxml.html.usedoctest`` from within a doctest.
3868
3869 * New module ``lxml.cssselect`` by Ian Bicking for selecting Elements with CSS
3870 selectors.
3871
3872 * New package ``lxml.html`` written by Ian Bicking for advanced HTML
3873 treatment.
3874
3875 * Namespace class setup is now local to the ``ElementNamespaceClassLookup``
3876 instance and no longer global.
3877
3878 * Schematron validation (incomplete in libxml2)
3879
3880 * Additional ``stringify`` argument to ``objectify.PyType()`` takes a
3881 conversion function to strings to support setting text values from arbitrary
3882 types.
3883
3884 * Entity support through an ``Entity`` factory and element classes. XML
3885 parsers now have a ``resolve_entities`` keyword argument that can be set to
3886 False to keep entities in the document.
3887
3888 * ``column`` field on error log entries to accompany the ``line`` field
3889
3890 * Error specific messages in XPath parsing and evaluation
3891 NOTE: for evaluation errors, you will now get an XPathEvalError instead of
3892 an XPathSyntaxError. To catch both, you can except on ``XPathError``
3893
3894 * The regular expression functions in XPath now support passing a node-set
3895 instead of a string
3896
3897 * Extended type annotation in objectify: new ``xsiannotate()`` function
3898
3899 * EXSLT RegExp support in standard XPath (not only XSLT)
3900
3901 Bugs fixed
3902 ----------
3903
3904 * Missing import in ``lxml.html.clean``.
3905
3906 * Some Python 2.4-isms prevented lxml from building/running under
3907 Python 2.3.
3908
3909 * XPath on ElementTrees could crash when selecting the virtual root
3910 node of the ElementTree.
3911
3912 * Compilation ``--without-threading`` was buggy in alpha5/6.
3913
3914 * Memory leak in the ``parse()`` function.
3915
3916 * Minor bugs in XSLT error message formatting.
3917
3918 * Result document memory leak in target parser.
3919
3920 * Target parser failed to report comments.
3921
3922 * In the ``lxml.html`` ``iter_links`` method, links in ``<object>``
3923 tags weren't recognized. (Note: plugin-specific link parameters
3924 still aren't recognized.) Also, the ``<embed>`` tag, though not
3925 standard, is now included in ``lxml.html.defs.special_inline_tags``.
3926
3927 * Using custom resolvers on XSLT stylesheets parsed from a string
3928 could request ill-formed URLs.
3929
3930 * With ``lxml.doctestcompare`` if you do ``<tag xmlns="...">`` in your
3931 output, it will then be namespace-neutral (before the ellipsis was
3932 treated as a real namespace).
3933
3934 * AttributeError in feed parser on parse errors
3935
3936 * XML feed parser setup problem
3937
3938 * Type annotation for unicode strings in ``DataElement()``
3939
3940 * lxml failed to serialise namespace declarations of elements other than the
3941 root node of a tree
3942
3943 * Race condition in XSLT where the resolver context leaked between concurrent
3944 XSLT calls
3945
3946 * lxml.etree did not check tag/attribute names
3947
3948 * The XML parser did not report undefined entities as error
3949
3950 * The text in exceptions raised by XML parsers, validators and XPath
3951 evaluators now reports the first error that occurred instead of the last
3952
3953 * Passing '' as XPath namespace prefix did not raise an error
3954
3955 * Thread safety in XPath evaluators
3956
3957 Other changes
3958 -------------
3959
3960 * Exceptions carry only the part of the error log that is related to
3961 the operation that caused the error.
3962
3963 * ``XMLSchema()`` and ``RelaxNG()`` now enforce passing the source
3964 file/filename through the ``file`` keyword argument.
3965
3966 * The test suite now skips most doctests under Python 2.3.
3967
3968 * ``make clean`` no longer removes the .c files (use ``make
3969 realclean`` instead)
3970
3971 * Minor performance tweaks for Element instantiation and subelement
3972 creation
3973
3974 * Various places in the XPath, XSLT and iteration APIs now require
3975 keyword-only arguments.
3976
3977 * The argument order in ``element.itersiblings()`` was changed to
3978 match the order used in all other iteration methods. The second
3979 argument ('preceding') is now a keyword-only argument.
3980
3981 * The ``getiterator()`` method on Elements and ElementTrees was
3982 reverted to return an iterator as it did in lxml 1.x. The ET API
3983 specification allows it to return either a sequence or an iterator,
3984 and it traditionally returned a sequence in ET and an iterator in
3985 lxml. However, it is now deprecated in favour of the ``iter()``
3986 method, which should be used in new code wherever possible.
3987
3988 * The 'pretty printed' serialisation of ElementTree objects now
3989 inserts newlines at the root level between processing instructions,
3990 comments and the root tag.
3991
3992 * A 'pretty printed' serialisation is now terminated with a newline.
3993
3994 * Second argument to ``lxml.etree.Extension()`` helper is no longer
3995 required, third argument is now a keyword-only argument ``ns``.
3996
3997 * ``lxml.html.tostring`` takes an ``encoding`` argument.
3998
3999 * The module source files were renamed to "lxml.*.pyx", such as
4000 "lxml.etree.pyx". This was changed for consistency with the way
4001 Pyrex commonly handles package imports. The main effect is that
4002 classes now know about their fully qualified class name, including
4003 the package name of their module.
4004
4005 * Keyword-only arguments in some API functions, especially in the
4006 parsers and serialisers.
4007
4008 * Tag name validation in lxml.etree (and lxml.html) now distinguishes
4009 between HTML tags and XML tags based on the parser that was used to
4010 parse or create them. HTML tags no longer reject any non-ASCII
4011 characters in tag names but only spaces and the special characters
4012 ``<>&/"'``.
4013
4014 * lxml.etree now emits a warning if you use XPath with libxml2 2.6.27
4015 (which can crash on certain XPath errors)
4016
4017 * Type annotation in objectify now preserves the already annotated type by
4018 default to prevent losing type information that is already there.
4019
4020 * ``element.getiterator()`` returns a list, use ``element.iter()`` to retrieve
4021 an iterator (ElementTree 1.3 compatible behaviour)
4022
4023 * objectify.PyType for None is now called "NoneType"
4024
4025 * ``el.getiterator()`` renamed to ``el.iter()``, following ElementTree 1.3 -
4026 original name is still available as alias
4027
4028 * In the public C-API, ``findOrBuildNodeNs()`` was replaced by the more
4029 generic ``findOrBuildNodeNsPrefix``
4030
4031 * Major refactoring in XPath/XSLT extension function code
4032
4033 * Network access in parsers disabled by default
4034
4035
4036 1.3.6 (2007-10-29)
4037 ==================
4038
4039 Bugs fixed
4040 ----------
4041
4042 * Backported decref crash fix from 2.0
4043
4044 * Well hidden free-while-in-use crash bug in ObjectPath
4045
4046 Other changes
4047 -------------
4048
4049 * The test suites now run ``gc.collect()`` in the ``tearDown()``
4050 methods. While this makes them take a lot longer to run, it also
4051 makes it easier to link a specific test to garbage collection
4052 problems that would otherwise appear in later tests.
4053
4054
4055 1.3.5 (2007-10-22)
4056 ==================
4057
4058 Features added
4059 --------------
4060
4061 Bugs fixed
4062 ----------
4063
4064 * lxml.etree could crash when adding more than 10000 namespaces to a
4065 document
4066
4067 * lxml failed to serialise namespace declarations of elements other
4068 than the root node of a tree
4069
4070
4071 1.3.4 (2007-08-30)
4072 ==================
4073
4074 Features added
4075 --------------
4076
4077 * The ``ElementMaker`` in ``lxml.builder`` now accepts the keyword arguments
4078 ``namespace`` and ``nsmap`` to set a namespace and nsmap for the Elements it
4079 creates.
4080
4081 * The ``docinfo`` on ElementTree objects has new properties ``internalDTD``
4082 and ``externalDTD`` that return a DTD object for the internal or external
4083 subset of the document respectively.
4084
4085 * Serialising an ElementTree now includes any internal DTD subsets that are
4086 part of the document, as well as comments and PIs that are siblings of the
4087 root node.
4088
4089 Bugs fixed
4090 ----------
4091
4092 * Parsing with the ``no_network`` option could fail
4093
4094 Other changes
4095 -------------
4096
4097 * lxml now raises a TagNameWarning about tag names containing ':' instead of
4098 an Error as 1.3.3 did. The reason is that a number of projects currently
4099 misuse the previous lack of tag name validation to generate namespace
4100 prefixes without declaring namespaces. Apart from the danger of generating
4101 broken XML this way, it also breaks most of the namespace-aware tools in
4102 XML, including XPath, XSLT and validation. lxml 1.3.x will continue to
4103 support this bug with a Warning, while lxml 2.0 will be strict about
4104 well-formed tag names (not only regarding ':').
4105
4106 * Serialising an Element no longer includes its comment and PI siblings (only
4107 ElementTree serialisation includes them).
4108
4109
4110 1.3.3 (2007-07-26)
4111 ==================
4112
4113 Features added
4114 --------------
4115
4116 * ElementTree compatible parser ``ETCompatXMLParser`` strips processing
4117 instructions and comments while parsing XML
4118
4119 * Parsers now support stripping PIs (keyword argument 'remove_pis')
4120
4121 * ``etree.fromstring()`` now supports parsing both HTML and XML, depending on
4122 the parser you pass.
4123
4124 * Support ``base_url`` keyword argument in ``HTML()`` and ``XML()``
4125
4126 Bugs fixed
4127 ----------
4128
4129 * Parsing from Python Unicode strings failed on some platforms
4130
4131 * ``Element()`` did not raise an exception on tag names containing ':'
4132
4133 * ``Element.getiterator(tag)`` did not accept ``Comment`` and
4134 ``ProcessingInstruction`` as tags. It also accepts ``Element`` now.
4135
4136
4137 1.3.2 (2007-07-03)
4138 ==================
4139
4140 Features added
4141 --------------
4142
4143 Bugs fixed
4144 ----------
4145
4146 * "deallocating None" crash bug
4147
4148
4149 1.3.1 (2007-07-02)
4150 ==================
4151
4152 Features added
4153 --------------
4154
4155 * objectify.DataElement now supports setting values from existing data
4156 elements (not just plain Python types) and reuses defined namespaces etc.
4157
4158 * E-factory support for lxml.objectify (``objectify.E``)
4159
4160 Bugs fixed
4161 ----------
4162
4163 * Better way to prevent crashes in Element proxy cleanup code
4164
4165 * objectify.DataElement didn't set up None value correctly
4166
4167 * objectify.DataElement didn't check the value against the provided type hints
4168
4169 * Reference-counting bug in ``Element.attrib.pop()``
4170
4171
4172 1.3 (2007-06-24)
4173 ================
4174
4175 Features added
4176 --------------
4177
4178 * The ``lxml.pyclasslookup`` module implements an Element class lookup
4179 scheme that can access the entire tree in read-only mode to help determining
4180 a suitable Element class
4181
4182 * Parsers take a ``remove_comments`` keyword argument that skips over comments
4183
4184 * ``parse()`` function in ``objectify``, corresponding to ``XML()`` etc.
4185
4186 * ``Element.addnext(el)`` and ``Element.addprevious(el)`` methods to support
4187 adding processing instructions and comments around the root node
4188
4189 * ``Element.attrib`` was missing ``clear()`` and ``pop()`` methods
4190
4191 * Extended type annotation in objectify: cleaner annotation namespace setup
4192 plus new ``deannotate()`` function
4193
4194 * Support for custom Element class instantiation in lxml.sax: passing a
4195 ``makeelement`` function to the ElementTreeContentHandler will reuse the
4196 lookup context of that function
4197
4198 * '.' represents empty ObjectPath (identity)
4199
4200 * ``Element.values()`` to accompany the existing ``.keys()`` and ``.items()``
4201
4202 * ``collectAttributes()`` C-function to build a list of attribute
4203 keys/values/items for a libxml2 node
4204
4205 * ``DTD`` validator class (like ``RelaxNG`` and ``XMLSchema``)
4206
4207 * HTML generator helpers by Fredrik Lundh in ``lxml.htmlbuilder``
4208
4209 * ``ElementMaker`` XML generator by Fredrik Lundh in ``lxml.builder.E``
4210
4211 * Support for pickling ``objectify.ObjectifiedElement`` objects to XML
4212
4213 * ``update()`` method on Element.attrib
4214
4215 * Optimised replacement for libxml2's _xmlReconsiliateNs(). This allows lxml
4216 a better handling of namespaces when moving elements between documents.
4217
4218 Bugs fixed
4219 ----------
4220
4221 * Removing Elements from a tree could make them lose their namespace
4222 declarations
4223
4224 * ``ElementInclude`` didn't honour base URL of original document
4225
4226 * Replacing the children slice of an Element would cut off the tails of the
4227 original children
4228
4229 * ``Element.getiterator(tag)`` did not accept ``Comment`` and
4230 ``ProcessingInstruction`` as tags
4231
4232 * API functions now check incoming strings for XML conformity. Zero bytes or
4233 low ASCII characters are no longer accepted (AssertionError).
4234
4235 * XSLT parsing failed to pass resolver context on to imported documents
4236
4237 * passing '' as namespace prefix in nsmap could be passed through to libxml2
4238
4239 * Objectify couldn't handle prefixed XSD type names in ``xsi:type``
4240
4241 * More ET compatible behaviour when writing out XML declarations or not
4242
4243 * More robust error handling in ``iterparse()``
4244
4245 * Documents lost their top-level PIs and comments on serialisation
4246
4247 * lxml.sax failed on comments and PIs. Comments are now properly ignored and
4248 PIs are copied.
4249
4250 * Possible memory leaks in namespace handling when moving elements between
4251 documents
4252
4253 Other changes
4254 -------------
4255
4256 * major restructuring in the documentation
4257
4258
4259 1.2.1 (2007-02-27)
4260 ==================
4261
4262 Bugs fixed
4263 ----------
4264
4265 * Build fixes for MS compiler
4266
4267 * Item assignments to special names like ``element["text"]`` failed
4268
4269 * Renamed ObjectifiedDataElement.__setText() to _setText() to make it easier
4270 to access
4271
4272 * The pattern for attribute names in ObjectPath was too restrictive
4273
4274
4275 1.2 (2007-02-20)
4276 ================
4277
4278 Features added
4279 --------------
4280
4281 * Rich comparison of QName objects
4282
4283 * Support for regular expressions in benchmark selection
4284
4285 * get/set emulation (not .attrib!) for attributes on processing instructions
4286
4287 * ElementInclude Python module for ElementTree compatible XInclude processing
4288 that honours custom resolvers registered with the source document
4289
4290 * ElementTree.parser property holds the parser used to parse the document
4291
4292 * setup.py has been refactored for greater readability and flexibility
4293
4294 * --rpath flag to setup.py to induce automatic linking-in of dynamic library
4295 runtime search paths has been renamed to --auto-rpath. This makes it
4296 possible to pass an --rpath directly to distutils; previously this was being
4297 shadowed.
4298
4299 Bugs fixed
4300 ----------
4301
4302 * Element instantiation now uses locks to prevent race conditions with threads
4303
4304 * ElementTree.write() did not raise an exception when the file was not writable
4305
4306 * Error handling could crash under Python <= 2.4.1 - fixed by disabling thread
4307 support in these environments
4308
4309 * Element.find*() did not accept QName objects as path
4310
4311 Other changes
4312 -------------
4313
4314 * code cleanup: redundant _NodeBase super class merged into _Element class
4315 Note: although the impact should be zero in most cases, this change breaks
4316 the compatibility of the public C-API
4317
4318
4319 1.1.2 (2006-10-30)
4320 ==================
4321
4322 Features added
4323 --------------
4324
4325 * Data elements in objectify support repr(), which is now used by dump()
4326
4327 * Source distribution now ships with a patched Pyrex
4328
4329 * New C-API function makeElement() to create new elements with text,
4330 tail, attributes and namespaces
4331
4332 * Reuse original parser flags for XInclude
4333
4334 * Simplified support for handling XSLT processing instructions
4335
4336 Bugs fixed
4337 ----------
4338
4339 * Parser resources were not freed before the next parser run
4340
4341 * Open files and XML strings returned by Python resolvers were not
4342 closed/freed
4343
4344 * Crash in the IDDict returned by XMLDTDID
4345
4346 * Copying Comments and ProcessingInstructions failed
4347
4348 * Memory leak for external URLs in _XSLTProcessingInstruction.parseXSL()
4349
4350 * Memory leak when garbage collecting tailed root elements
4351
4352 * HTML script/style content was not propagated to .text
4353
4354 * Show text xincluded between text nodes correctly in .text and .tail
4355
4356 * 'integer * objectify.StringElement' operation was not supported
4357
4358
4359 1.1.1 (2006-09-21)
4360 ==================
4361
4362 Features added
4363 --------------
4364
4365 * XSLT profiling support (``profile_run`` keyword)
4366
4367 * countchildren() method on objectify.ObjectifiedElement
4368
4369 * Support custom elements for tree nodes in lxml.objectify
4370
4371 Bugs fixed
4372 ----------
4373
4374 * lxml.objectify failed to support long data values (e.g., "123L")
4375
4376 * Error messages from XSLT did not reach ``XSLT.error_log``
4377
4378 * Factories objectify.Element() and objectify.DataElement() were missing
4379 ``attrib`` and ``nsmap`` keyword arguments
4380
4381 * Changing the default parser in lxml.objectify did not update the factories
4382 Element() and DataElement()
4383
4384 * Let lxml.objectify.Element() always generate tree elements (not data
4385 elements)
4386
4387 * Build under Windows failed ('\0' bug in patched Pyrex version)
4388
4389
4390 1.1 (2006-09-13)
4391 ================
4392
4393 Features added
4394 --------------
4395
4396 * Comments and processing instructions return '<!-- comment -->' and
4397 '<?pi-target content?>' for repr()
4398
4399 * Parsers are now the preferred (and default) place where element class lookup
4400 schemes should be registered. Namespace lookup is no longer supported by
4401 default.
4402
4403 * Support for Python 2.5 beta
4404
4405 * Unlock the GIL for deep copying documents and for XPath()
4406
4407 * New ``compact`` keyword argument for parsing read-only documents
4408
4409 * Support for parser options in iterparse()
4410
4411 * The ``namespace`` axis is supported in XPath and returns (prefix, URI)
4412 tuples
4413
4414 * The XPath expression "/" now returns an empty list instead of raising an
4415 exception
4416
4417 * XML-Object API on top of lxml (lxml.objectify)
4418
4419 * Customizable Element class lookup:
4420
4421 * different pre-implemented lookup mechanisms
4422
4423 * support for externally provided lookup functions
4424
4425 * Support for processing instructions (ET-like, not compatible)
4426
4427 * Public C-level API for independent extension modules
4428
4429 * Module level ``iterwalk()`` function as 'iterparse' for trees
4430
4431 * Module level ``iterparse()`` function similar to ElementTree (see
4432 documentation for differences)
4433
4434 * Element.nsmap property returns a mapping of all namespace prefixes known at
4435 the Element to their namespace URI
4436
4437 * Reentrant threading support in RelaxNG, XMLSchema and XSLT
4438
4439 * Threading support in parsers and serializers:
4440
4441 * All in-memory operations (tostring, parse(StringIO), etc.) free the GIL
4442
4443 * File operations (on file names) free the GIL
4444
4445 * Reading from file-like objects frees the GIL and reacquires it for reading
4446
4447 * Serialisation to file-like objects is single-threaded (high lock overhead)
4448
4449 * Element iteration over XPath axes:
4450
4451 * Element.iterdescendants() iterates over the descendants of an element
4452
4453 * Element.iterancestors() iterates over the ancestors of an element (from
4454 parent to parent)
4455
4456 * Element.itersiblings() iterates over either the following or preceding
4457 siblings of an element
4458
4459 * Element.iterchildren() iterates over the children of an element in either
4460 direction
4461
4462 * All iterators support the ``tag`` keyword argument to restrict the
4463 generated elements
4464
4465 * Element.getnext() and Element.getprevious() return the direct siblings of an
4466 element
4467
4468 Bugs fixed
4469 ----------
4470
4471 * filenames with local 8-bit encoding were not supported
4472
4473 * 1.1beta did not compile under Python 2.3
4474
4475 * ignore unknown 'pyval' attribute values in objectify
4476
4477 * objectify.ObjectifiedElement.addattr() failed to accept Elements and Lists
4478
4479 * objectify.ObjectPath.setattr() failed to accept Elements and Lists
4480
4481 * XPathSyntaxError now inherits from XPathError
4482
4483 * Threading race conditions in RelaxNG and XMLSchema
4484
4485 * Crash when mixing elements from XSLT results into other trees, concurrent
4486 XSLT is only allowed when the stylesheet was parsed in the main thread
4487
4488 * The EXSLT ``regexp:match`` function now works as defined (except for some
4489 differences in the regular expression syntax)
4490
4491 * Setting element.text to '' returned None on request, not the empty string
4492
4493 * ``iterparse()`` could crash on long XML files
4494
4495 * Creating documents no longer copies the parser for later URL resolving. For
4496 performance reasons, only a reference is kept. Resolver updates on the
4497 parser will now be reflected by documents that were parsed before the
4498 change. Although this should rarely become visible, it is a behavioral
4499 change from 1.0.
4500
4501
4502 1.0.4 (2006-09-09)
4503 ==================
4504
4505 Features added
4506 --------------
4507
4508 * List-like ``Element.extend()`` method
4509
4510 Bugs fixed
4511 ----------
4512
4513 * Crash in tail handling in ``Element.replace()``
4514
4515
4516 1.0.3 (2006-08-08)
4517 ==================
4518
4519 Features added
4520 --------------
4521
4522 * Element.replace(old, new) method to replace a subelement by another one
4523
4524 Bugs fixed
4525 ----------
4526
4527 * Crash when mixing elements from XSLT results into other trees
4528
4529 * Copying/deepcopying did not work for ElementTree objects
4530
4531 * Setting an attribute to a non-string value did not raise an exception
4532
4533 * Element.remove() deleted the tail text from the removed Element
4534
4535
4536 1.0.2 (2006-06-27)
4537 ==================
4538
4539 Features added
4540 --------------
4541
4542 * Support for setting a custom default Element class as opposed to namespace
4543 specific classes (which still override the default class)
4544
4545 Bugs fixed
4546 ----------
4547
4548 * Rare exceptions in Python list functions were not handled
4549
4550 * Parsing accepted unicode strings with XML encoding declaration in certain
4551 cases
4552
4553 * Parsing 8-bit encoded strings from StringIO objects raised an exception
4554
4555 * Module function ``initThread()`` was removed - useless (and never worked)
4556
4557 * XSLT and parser exception messages include the error line number
4558
4559
4560 1.0.1 (2006-06-09)
4561 ==================
4562
4563 Features added
4564 --------------
4565
4566 * Repeated calls to Element.attrib now efficiently return the same instance
4567
4568 Bugs fixed
4569 ----------
4570
4571 * Document deallocation could crash in certain garbage collection scenarios
4572
4573 * Extension function calls in XSLT variable declarations could break the
4574 stylesheet and crash on repeated calls
4575
4576 * Deep copying Elements could lose namespaces declared in parents
4577
4578 * Deep copying Elements did not copy tail
4579
4580 * Parsing file(-like) objects failed to load external entities
4581
4582 * Parsing 8-bit strings from file(-like) objects raised an exception
4583
4584 * xsl:include failed when the stylesheet was parsed from a file-like object
4585
4586 * lxml.sax.ElementTreeProducer did not call startDocument() / endDocument()
4587
4588 * MSVC compiler complained about long strings (supports only 2048 bytes)
4589
4590
4591 1.0 (2006-06-01)
4592 ================
4593
4594 Features added
4595 --------------
4596
4597 * Element.getiterator() and the findall() methods support finding arbitrary
4598 elements from a namespace (pattern ``{namespace}*``)
4599
4600 * Another speedup in tree iteration code
4601
4602 * General speedup of Python Element object creation and deallocation
4603
4604 * Writing C14N no longer serializes in memory (reduced memory footprint)
4605
4606 * PyErrorLog for error logging through the Python ``logging`` module
4607
4608 * ``Element.getroottree()`` returns an ElementTree for the root node of the
4609 document that contains the element.
4610
4611 * ElementTree.getpath(element) returns a simple, absolute XPath expression to
4612 find the element in the tree structure
4613
4614 * Error logs have a ``last_error`` attribute for convenience
4615
4616 * Comment texts can be changed through the API
4617
4618 * Formatted output via ``pretty_print`` keyword in serialization functions
4619
4620 * XSLT can block access to file system and network via ``XSLTAccessControl``
4621
4622 * ElementTree.write() no longer serializes in memory (reduced memory
4623 footprint)
4624
4625 * Speedup of Element.findall(tag) and Element.getiterator(tag)
4626
4627 * Support for writing the XML representation of Elements and ElementTrees to
4628 Python unicode strings via ``etree.tounicode()``
4629
4630 * Support for writing XSLT results to Python unicode strings via ``unicode()``
4631
4632 * Parsing a unicode string no longer copies the string (reduced memory
4633 footprint)
4634
4635 * Parsing file-like objects reads chunks rather than the whole file (reduced
4636 memory footprint)
4637
4638 * Parsing StringIO objects from the start avoids copying the string (reduced
4639 memory footprint)
4640
4641 * Read-only 'docinfo' attribute in ElementTree class holds DOCTYPE
4642 information, original encoding and XML version as seen by the parser
4643
4644 * etree module can be compiled without libxslt by commenting out the line
4645 ``include "xslt.pxi"`` near the end of the etree.pyx source file
4646
4647 * Better error messages in parser exceptions
4648
4649 * Error reporting also works in XSLT
4650
4651 * Support for custom document loaders (URI resolvers) in parsers and XSLT,
4652 resolvers are registered at parser level
4653
4654 * Implementation of exslt:regexp for XSLT based on the Python 're' module,
4655 enabled by default, can be switched off with 'regexp=False' keyword argument
4656
4657 * Support for exslt extensions (libexslt) and libxslt extra functions
4658 (node-set, document, write, output)
4659
4660 * Substantial speedup in XPath.evaluate()
4661
4662 * HTMLParser for parsing (broken) HTML
4663
4664 * XMLDTDID function parses XML into tuple (root node, ID dict) based on xml:id
4665 implementation of libxml2 (as opposed to ET compatible XMLID)
4666
4667 Bugs fixed
4668 ----------
4669
4670 * Memory leak in Element.__setitem__
4671
4672 * Memory leak in Element.attrib.items() and Element.attrib.values()
4673
4674 * Memory leak in XPath extension functions
4675
4676 * Memory leak in unicode related setup code
4677
4678 * Element now raises ValueError on empty tag names
4679
4680 * Namespace fixing after moving elements between documents could fail if the
4681 source document was freed too early
4682
4683 * Setting namespace-less tag names on namespaced elements ('{ns}t' -> 't')
4684 didn't reset the namespace
4685
4686 * Unknown constants from newer libxml2 versions could raise exceptions in the
4687 error handlers
4688
4689 * lxml.etree compiles much faster
4690
4691 * On libxml2 <= 2.6.22, parsing strings with encoding declaration could fail
4692 in certain cases
4693
4694 * Document reference in ElementTree objects was not updated when the root
4695 element was moved to a different document
4696
4697 * Running absolute XPath expressions on an Element now evaluates against the
4698 root tree
4699
4700 * Evaluating absolute XPath expressions (``/*``) on an ElementTree could fail
4701
4702 * Crashes when calling XSLT, RelaxNG, etc. with uninitialized ElementTree
4703 objects
4704
4705 * Removed public function ``initThreadLogging()``, replaced by more general
4706 ``initThread()`` which fixes a number of setup problems in threads
4707
4708 * Memory leak when using iconv encoders in tostring/write
4709
4710 * Deep copying Elements and ElementTrees maintains the document information
4711
4712 * Serialization functions raise LookupError for unknown encodings
4713
4714 * Memory deallocation crash resulting from deep copying elements
4715
4716 * Some ElementTree methods could crash if the root node was not initialized
4717 (neither file nor element passed to the constructor)
4718
4719 * Element/SubElement failed to set attribute namespaces from passed ``attrib``
4720 dictionary
4721
4722 * ``tostring()`` adds an XML declaration for non-ASCII encodings
4723
4724 * ``tostring()`` failed to serialize encodings that contain 0-bytes
4725
4726 * ElementTree.xpath() and XPathDocumentEvaluator were not using the
4727 ElementTree root node as reference point
4728
4729 * Calling ``document('')`` in XSLT failed to return the stylesheet
4730
4731
4732 0.9.2 (2006-05-10)
4733 ==================
4734
4735 Features added
4736 --------------
4737
4738 * Speedup for Element.makeelement(): the new element reuses the original
4739 libxml2 document instead of creating a new empty one
4740
4741 * Speedup for reversed() iteration over element children (Py2.4+ only)
4742
4743 * ElementTree compatible QName class
4744
4745 * RelaxNG and XMLSchema accept any Element, not only ElementTrees
4746
4747 Bugs fixed
4748 ----------
4749
4750 * str(xslt_result) was broken for XSLT output other than UTF-8
4751
4752 * Memory leak if write_c14n fails to write the file after conversion
4753
4754 * Crash in XMLSchema and RelaxNG when passing non-schema documents
4755
4756 * Memory leak in RelaxNG() when RelaxNGParseError is raised
4757
4758 0.9.1 (2006-03-30)
4759 ==================
4760
4761 Features added
4762 --------------
4763
4764 * lxml.sax.ElementTreeContentHandler checks closing elements and raises
4765 SaxError on mismatch
4766
4767 * lxml.sax.ElementTreeContentHandler supports namespace-less SAX events
4768 (startElement, endElement) and defaults to empty attributes (keyword
4769 argument)
4770
4771 * Speedup for repeatedly accessing element tag names
4772
4773 * Minor API performance improvements
4774
4775 Bugs fixed
4776 ----------
4777
4778 * Memory deallocation bug when using XSLT output method "html"
4779
4780 * sax.py was handling UTF-8 encoded tag names where it shouldn't
4781
4782 * lxml.tests package will no longer be installed (is still in source tar)
4783
4784 0.9 (2006-03-20)
4785 ================
4786
4787 Features added
4788 --------------
4789
4790 * Error logging API for libxml2 error messages
4791
4792 * Various performance improvements
4793
4794 * Benchmark script for lxml, ElementTree and cElementTree
4795
4796 * Support for registering extension functions through new FunctionNamespace
4797 class (see doc/extensions.txt)
4798
4799 * ETXPath class for XPath expressions in ElementTree notation ('//{ns}tag')
4800
4801 * Support for variables in XPath expressions (also in XPath class)
4802
4803 * XPath class for compiled XPath expressions
4804
4805 * XMLID module level function (ElementTree compatible)
4806
4807 * XMLParser API for customized libxml2 parser configuration
4808
4809 * Support for custom Element classes through new Namespace API (see
4810 doc/namespace_extensions.txt)
4811
4812 * Common exception base class LxmlError for module exceptions
4813
4814 * real iterator support in iter(Element), Element.getiterator()
4815
4816 * XSLT objects are callable, result trees support str()
4817
4818 * Added MANIFEST.in for easier creation of RPM files.
4819
4820 * 'getparent' method on elements allows navigation to an element's
4821 parent element.
4822
4823 * Python core compatible SAX tree builder and SAX event generator. See
4824 doc/sax.txt for more information.
4825
4826 Bugs fixed
4827 ----------
4828
4829 * Segfaults and memory leaks in various API functions of Element
4830
4831 * Segfault in XSLT.tostring()
4832
4833 * ElementTree objects no longer interfere, Elements can be root of different
4834 ElementTrees at the same time
4835
4836 * document('') works in XSLT documents read from files (in-memory documents
4837 cannot support this due to libxslt deficiencies)
4838
4839 0.8 (2005-11-03)
4840 ================
4841
4842 Features added
4843 --------------
4844
4845 * Support for copy.deepcopy() on elements. copy.copy() works also, but
4846 does the same thing, and does *not* create a shallow copy, as that
4847 makes no sense in the context of libxml2 trees. This means a
4848 potential incompatibility with ElementTree, but there's more chance
4849 that it works than if copy.copy() isn't supported at all.
4850
4851 * Increased compatibility with (c)ElementTree; .parse() on ElementTree is
4852 supported and parsing of gzipped XML files works.
4853
4854 * implemented index() on elements, allowing one to find the index of a
4855 SubElement.
4856
4857 Bugs fixed
4858 ----------
4859
4860 * Use xslt-config instead of xml2-config to find out libxml2
4861 directories to take into account a case where libxslt is installed
4862 in a different directory than libxslt.
4863
4864 * Eliminate crash condition in iteration when text nodes are changed.
4865
4866 * Passing 'None' to tostring() does not result in a segfault anymore,
4867 but an AssertionError.
4868
4869 * Some test fixes for Windows.
4870
4871 * Raise XMLSyntaxError and XPathSyntaxError instead of plain python
4872 syntax errors. This should be less confusing.
4873
4874 * Fixed error with uncaught exception in Pyrex code.
4875
4876 * Calling lxml.etree.fromstring('') throws XMLSyntaxError instead of a
4877 segfault.
4878
4879 * has_key() works on attrib. 'in' tests also work correctly on attrib.
4880
4881 * INSTALL.txt was saying 2.2.16 instead of 2.6.16 as a supported
4882 libxml2 version, as it should.
4883
4884 * Passing a UTF-8 encoded string to the XML() function would fail;
4885 fixed.
4886
4887 0.7 (2005-06-15)
4888 ================
4889
4890 Features added
4891 --------------
4892
4893 * parameters (XPath expressions) can be passed to XSLT using keyword
4894 parameters.
4895
4896 * Simple XInclude support. Calling the xinclude() method on a tree
4897 will process any XInclude statements in the document.
4898
4899 * XMLSchema support. Use the XMLSchema class or the convenience
4900 xmlschema() method on a tree to do XML Schema (XSD) validation.
4901
4902 * Added convenience xslt() method on tree. This is less efficient
4903 than the XSLT object, but makes it easier to write quick code.
4904
4905 * Added convenience relaxng() method on tree. This is less efficient
4906 than the RelaxNG object, but makes it easier to write quick code.
4907
4908 * Make it possible to use XPathEvaluator with elements as well. The
4909 XPathEvaluator in this case will retain the element so multiple
4910 XPath queries can be made against one element efficiently. This
4911 replaces the second argument to the .evaluate() method that existed
4912 previously.
4913
4914 * Allow registerNamespace() to be called on an XPathEvaluator, after
4915 creation, to add additional namespaces. Also allow registerNamespaces(),
4916 which does the same for a namespace dictionary.
4917
4918 * Add 'prefix' attribute to element to be able to read prefix information.
4919 This is entirely read-only.
4920
4921 * It is possible to supply an extra nsmap keyword parameter to
4922 the Element() and SubElement() constructors, which supplies a
4923 prefix to namespace URI mapping. This will create namespace
4924 prefix declarations on these elements and these prefixes will show up
4925 in XML serialization.
4926
4927 Bugs fixed
4928 ----------
4929
4930 * Killed yet another memory management related bug: trees created
4931 using newDoc would not get a libxml2-level dictionary, which caused
4932 problems when deallocating these documents later if they contained a
4933 node that came from a document with a dictionary.
4934
4935 * Moving namespaced elements between documents was problematic as
4936 references to the original document would remain. This has been fixed
4937 by applying xmlReconciliateNs() after each move operation.
4938
4939 * Can pass None to 'dump()' without segfaults.
4940
4941 * tostring() works properly for non-root elements as well.
4942
4943 * Cleaned out the tostring() method so it should handle encoding
4944 correctly.
4945
4946 * Cleaned out the ElementTree.write() method so it should handle encoding
4947 correctly. Writing directly to a file should also be faster, as there is no
4948 need to go through a Python string in that case. Made sure the test cases
4949 test both serializing to StringIO as well as serializing to a real file.
4950
4951 0.6 (2005-05-14)
4952 ================
4953
4954 Features added
4955 --------------
4956
4957 * Changed setup.py so that library_dirs is also guessed. This should
4958 help with compilation on the Mac OS X platform, where otherwise the
4959 wrong library (shipping with the OS) could be picked up.
4960
4961 * Tweaked setup.py so that it picks up the version from version.txt.
4962
4963 Bugs fixed
4964 ----------
4965
4966 * Do the right thing when handling namespaced attributes.
4967
4968 * fix bug where tostring() moved nodes into new documents. tostring()
4969 had very nasty side-effects before this fix, sorry!
4970
4971 0.5.1 (2005-04-09)
4972 ==================
4973
4974 * Python 2.2 compatibility fixes.
4975
4976 * unicode fixes in Element() and Comment() as well as XML(); unicode
4977 input wasn't properly being UTF-8 encoded.
4978
4979 0.5 (2005-04-08)
4980 ================
4981
4982 Initial public release.