CHANGES.txt 57 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069
  1. ==============
  2. lxml changelog
  3. ==============
  4. 2.2.2 (2009-06-21)
  5. ==================
  6. Features added
  7. --------------
  8. * New helper functions ``strip_attributes()``, ``strip_elements()``,
  9. ``strip_tags()`` in lxml.etree to remove attributes/subtrees/tags
  10. from a subtree.
  11. Bugs fixed
  12. ----------
  13. * Namespace cleanup on subtree insertions could result in missing
  14. namespace declarations (and potentially crashes) if the element
  15. defining a namespace was deleted and the namespace was not used by
  16. the top element of the inserted subtree but only in deeper subtrees.
  17. * Raising an exception from a parser target callback didn't always
  18. terminate the parser.
  19. * Only {true, false, 1, 0} are accepted as the lexical representation for
  20. BoolElement ({True, False, T, F, t, f} not any more), restoring lxml <= 2.0
  21. behaviour.
  22. Other changes
  23. -------------
  24. 2.2.1 (2009-06-02)
  25. ==================
  26. Features added
  27. --------------
  28. * Injecting default attributes into a document during XML Schema
  29. validation (also at parse time).
  30. * Pass ``huge_tree`` parser option to disable parser security
  31. restrictions imposed by libxml2 2.7.
  32. Bugs fixed
  33. ----------
  34. * The script for statically building libxml2 and libxslt didn't work
  35. in Py3.
  36. * ``XMLSchema()`` also passes invalid schema documents on to libxml2
  37. for parsing (which could lead to a crash before release 2.6.24).
  38. Other changes
  39. -------------
  40. 2.2 (2009-03-21)
  41. ================
  42. Features added
  43. --------------
  44. * Support for ``standalone`` flag in XML declaration through
  45. ``tree.docinfo.standalone`` and by passing ``standalone=True/False``
  46. on serialisation.
  47. Bugs fixed
  48. ----------
  49. * Crash when parsing an XML Schema with external imports from a
  50. filename.
  51. 2.2beta4 (2009-02-27)
  52. =====================
  53. Features added
  54. --------------
  55. * Support strings and instantiable Element classes as child arguments
  56. to the constructor of custom Element classes.
  57. * GZip compression support for serialisation to files and file-like
  58. objects.
  59. Bugs fixed
  60. ----------
  61. * Deep-copying an ElementTree copied neither its sibling PIs and
  62. comments nor its internal/external DTD subsets.
  63. * Soupparser failed on broken attributes without values.
  64. * Crash in XSLT when overwriting an already defined attribute using
  65. ``xsl:attribute``.
  66. * Crash bug in exception handling code under Python 3. This was due
  67. to a problem in Cython, not lxml itself.
  68. * ``lxml.html.FormElement._name()`` failed for non top-level forms.
  69. * ``TAG`` special attribute in constructor of custom Element classes
  70. was evaluated incorrectly.
  71. Other changes
  72. -------------
  73. * Official support for Python 3.0.1.
  74. * ``Element.findtext()`` now returns an empty string instead of None
  75. for Elements without text content.
  76. 2.2beta3 (2009-02-17)
  77. =====================
  78. Features added
  79. --------------
  80. * ``XSLT.strparam()`` class method to wrap quoted string parameters
  81. that require escaping.
  82. Bugs fixed
  83. ----------
  84. * Memory leak in XPath evaluators.
  85. * Crash when parsing indented XML in one thread and merging it with
  86. other documents parsed in another thread.
  87. * Setting the ``base`` attribute in ``lxml.objectify`` from a unicode
  88. string failed.
  89. * Fixes following changes in Python 3.0.1.
  90. * Minor fixes for Python 3.
  91. Other changes
  92. -------------
  93. * The global error log (which is copied into the exception log) is now
  94. local to a thread, which fixes some race conditions.
  95. * More robust error handling on serialisation.
  96. 2.2beta2 (2009-01-25)
  97. =====================
  98. Bugs fixed
  99. ----------
  100. * Potential memory leak on exception handling. This was due to a
  101. problem in Cython, not lxml itself.
  102. * ``iter_links`` (and related link-rewriting functions) in
  103. ``lxml.html`` would interpret CSS like ``url("link")`` incorrectly
  104. (treating the quotation marks as part of the link).
  105. * Failing import on systems that have an ``io`` module.
  106. 2.1.5 (2009-01-06)
  107. ==================
  108. Bugs fixed
  109. ----------
  110. * Potential memory leak on exception handling. This was due to a
  111. problem in Cython, not lxml itself.
  112. * Failing import on systems that have an ``io`` module.
  113. 2.2beta1 (2008-12-12)
  114. =====================
  115. Features added
  116. --------------
  117. * Allow ``lxml.html.diff.htmldiff`` to accept Element objects, not
  118. just HTML strings.
  119. Bugs fixed
  120. ----------
  121. * Crash when using an XPath evaluator in multiple threads.
  122. * Fixed missing whitespace before ``Link:...`` in ``lxml.html.diff``.
  123. Other changes
  124. -------------
  125. * Export ``lxml.html.parse``.
  126. 2.1.4 (2008-12-12)
  127. ==================
  128. Bugs fixed
  129. ----------
  130. * Crash when using an XPath evaluator in multiple threads.
  131. 2.0.11 (2008-12-12)
  132. ===================
  133. Bugs fixed
  134. ----------
  135. * Crash when using an XPath evaluator in multiple threads.
  136. 2.2alpha1 (2008-11-23)
  137. ======================
  138. Features added
  139. --------------
  140. * Support for XSLT result tree fragments in XPath/XSLT extension
  141. functions.
  142. * QName objects have new properties ``namespace`` and ``localname``.
  143. * New options for exclusive C14N and C14N without comments.
  144. * Instantiating a custom Element classes creates a new Element.
  145. Bugs fixed
  146. ----------
  147. * XSLT didn't inherit the parse options of the input document.
  148. * 0-bytes could slip through the API when used inside of Unicode
  149. strings.
  150. * With ``lxml.html.clean.autolink``, links with balanced parenthesis,
  151. that end in a parenthesis, will be linked in their entirety (typical
  152. with Wikipedia links).
  153. Other changes
  154. -------------
  155. 2.1.3 (2008-11-17)
  156. ==================
  157. Features added
  158. --------------
  159. Bugs fixed
  160. ----------
  161. * Ref-count leaks when lxml enters a try-except statement while an
  162. outside exception lives in sys.exc_*(). This was due to a problem in
  163. Cython, not lxml itself.
  164. * Parser Unicode decoding errors could get swallowed by other
  165. exceptions.
  166. * Name/import errors in some Python modules.
  167. * Internal DTD subsets that did not specify a system or public ID were
  168. not serialised and did not appear in the docinfo property of
  169. ElementTrees.
  170. * Fix a pre-Py3k warning when parsing from a gzip file in Py2.6.
  171. * Test suite fixes for libxml2 2.7.
  172. * Resolver.resolve_string() did not work for non-ASCII byte strings.
  173. * Resolver.resolve_file() was broken.
  174. * Overriding the parser encoding didn't work for many encodings.
  175. Other changes
  176. -------------
  177. 2.0.10 (2008-11-17)
  178. ===================
  179. Bugs fixed
  180. ----------
  181. * Ref-count leaks when lxml enters a try-except statement while an
  182. outside exception lives in sys.exc_*(). This was due to a problem in
  183. Cython, not lxml itself.
  184. 2.1.2 (2008-09-05)
  185. ==================
  186. Features added
  187. --------------
  188. * lxml.etree now tries to find the absolute path name of files when
  189. parsing from a file-like object. This helps custom resolvers when
  190. resolving relative URLs, as lixbml2 can prepend them with the path
  191. of the source document.
  192. Bugs fixed
  193. ----------
  194. * Memory problem when passing documents between threads.
  195. * Target parser did not honour the ``recover`` option and raised an
  196. exception instead of calling ``.close()`` on the target.
  197. Other changes
  198. -------------
  199. 2.0.9 (2008-09-05)
  200. ==================
  201. Bugs fixed
  202. ----------
  203. * Memory problem when passing documents between threads.
  204. * Target parser did not honour the ``recover`` option and raised an
  205. exception instead of calling ``.close()`` on the target.
  206. 2.1.1 (2008-07-24)
  207. ==================
  208. Features added
  209. --------------
  210. Bugs fixed
  211. ----------
  212. * Crash when parsing XSLT stylesheets in a thread and using them in
  213. another.
  214. * Encoding problem when including text with ElementInclude under
  215. Python 3.
  216. Other changes
  217. -------------
  218. 2.0.8 (2008-07-24)
  219. ==================
  220. Features added
  221. --------------
  222. * ``lxml.html.rewrite_links()`` strips links to work around documents
  223. with whitespace in URL attributes.
  224. Bugs fixed
  225. ----------
  226. * Crash when parsing XSLT stylesheets in a thread and using them in
  227. another.
  228. * CSS selector parser dropped remaining expression after a function
  229. with parameters.
  230. Other changes
  231. -------------
  232. 2.1 (2008-07-09)
  233. ================
  234. Features added
  235. --------------
  236. * Smart strings can be switched off in XPath (``smart_strings``
  237. keyword option).
  238. * ``lxml.html.rewrite_links()`` strips links to work around documents
  239. with whitespace in URL attributes.
  240. Bugs fixed
  241. ----------
  242. * Custom resolvers were not used for XMLSchema includes/imports and
  243. XInclude processing.
  244. * CSS selector parser dropped remaining expression after a function
  245. with parameters.
  246. Other changes
  247. -------------
  248. * ``objectify.enableRecursiveStr()`` was removed, use
  249. ``objectify.enable_recursive_str()`` instead
  250. * Speed-up when running XSLTs on documents from other threads
  251. 2.0.7 (2008-06-20)
  252. ==================
  253. Features added
  254. --------------
  255. * Pickling ``ElementTree`` objects in lxml.objectify.
  256. Bugs fixed
  257. ----------
  258. * Descending dot-separated classes in CSS selectors were not resolved
  259. correctly.
  260. * ``ElementTree.parse()`` didn't handle target parser result.
  261. * Potential threading problem in XInclude.
  262. * Crash in Element class lookup classes when the __init__() method of
  263. the super class is not called from Python subclasses.
  264. Other changes
  265. -------------
  266. * Non-ASCII characters in attribute values are no longer escaped on
  267. serialisation.
  268. 2.1beta3 (2008-06-19)
  269. =====================
  270. Features added
  271. --------------
  272. * Major overhaul of ``tools/xpathgrep.py`` script.
  273. * Pickling ``ElementTree`` objects in lxml.objectify.
  274. * Support for parsing from file-like objects that return unicode
  275. strings.
  276. * New function ``etree.cleanup_namespaces(el)`` that removes unused
  277. namespace declarations from a (sub)tree (experimental).
  278. * XSLT results support the buffer protocol in Python 3.
  279. * Polymorphic functions in ``lxml.html`` that accept either a tree or
  280. a parsable string will return either a UTF-8 encoded byte string, a
  281. unicode string or a tree, based on the type of the input.
  282. Previously, the result was always a byte string or a tree.
  283. * Support for Python 2.6 and 3.0 beta.
  284. * File name handling now uses a heuristic to convert between byte
  285. strings (usually filenames) and unicode strings (usually URLs).
  286. * Parsing from a plain file object frees the GIL under Python 2.x.
  287. * Running ``iterparse()`` on a plain file (or filename) frees the GIL
  288. on reading under Python 2.x.
  289. * Conversion functions ``html_to_xhtml()`` and ``xhtml_to_html()`` in
  290. lxml.html (experimental).
  291. * Most features in lxml.html work for XHTML namespaced tag names
  292. (experimental).
  293. Bugs fixed
  294. ----------
  295. * ``ElementTree.parse()`` didn't handle target parser result.
  296. * Crash in Element class lookup classes when the __init__() method of
  297. the super class is not called from Python subclasses.
  298. * A number of problems related to unicode/byte string conversion of
  299. filenames and error messages were fixed.
  300. * Building on MacOS-X now passes the "flat_namespace" option to the C
  301. compiler, which reportedly prevents build quirks and crashes on this
  302. platform.
  303. * Windows build was broken.
  304. * Rare crash when serialising to a file object with certain encodings.
  305. Other changes
  306. -------------
  307. * Non-ASCII characters in attribute values are no longer escaped on
  308. serialisation.
  309. * Passing non-ASCII byte strings or invalid unicode strings as .tag,
  310. namespaces, etc. will result in a ValueError instead of an
  311. AssertionError (just like the tag well-formedness check).
  312. * Up to several times faster attribute access (i.e. tree traversal) in
  313. lxml.objectify.
  314. 2.0.6 (2008-05-31)
  315. ==================
  316. Features added
  317. --------------
  318. Bugs fixed
  319. ----------
  320. * Incorrect evaluation of ``el.find("tag[child]")``.
  321. * Windows build was broken.
  322. * Moving a subtree from a document created in one thread into a
  323. document of another thread could crash when the rest of the source
  324. document is deleted while the subtree is still in use.
  325. * Rare crash when serialising to a file object with certain encodings.
  326. Other changes
  327. -------------
  328. * lxml should now build without problems on MacOS-X.
  329. 2.1beta2 (2008-05-02)
  330. =====================
  331. Features added
  332. --------------
  333. * All parse functions in lxml.html take a ``parser`` keyword argument.
  334. * lxml.html has a new parser class ``XHTMLParser`` and a module
  335. attribute ``xhtml_parser`` that provide XML parsers that are
  336. pre-configured for the lxml.html package.
  337. Bugs fixed
  338. ----------
  339. * Moving a subtree from a document created in one thread into a
  340. document of another thread could crash when the rest of the source
  341. document is deleted while the subtree is still in use.
  342. * Passing an nsmap when creating an Element will no longer strip
  343. redundantly defined namespace URIs. This prevented the definition
  344. of more than one prefix for a namespace on the same Element.
  345. Other changes
  346. -------------
  347. * If the default namespace is redundantly defined with a prefix on the
  348. same Element, the prefix will now be preferred for subelements and
  349. attributes. This allows users to work around a problem in libxml2
  350. where attributes from the default namespace could serialise without
  351. a prefix even when they appear on an Element with a different
  352. namespace (i.e. they would end up in the wrong namespace).
  353. 2.0.5 (2008-05-01)
  354. ==================
  355. Features added
  356. --------------
  357. Bugs fixed
  358. ----------
  359. * Resolving to a filename in custom resolvers didn't work.
  360. * lxml did not honour libxslt's second error state "STOPPED", which
  361. let some XSLT errors pass silently.
  362. * Memory leak in Schematron with libxml2 >= 2.6.31.
  363. Other changes
  364. -------------
  365. 2.1beta1 (2008-04-15)
  366. =====================
  367. Features added
  368. --------------
  369. * Error logging in Schematron (requires libxml2 2.6.32 or later).
  370. * Parser option ``strip_cdata`` for normalising or keeping CDATA
  371. sections. Defaults to ``True`` as before, thus replacing CDATA
  372. sections by their text content.
  373. * ``CDATA()`` factory to wrap string content as CDATA section.
  374. Bugs fixed
  375. ----------
  376. * Resolving to a filename in custom resolvers didn't work.
  377. * lxml did not honour libxslt's second error state "STOPPED", which
  378. let some XSLT errors pass silently.
  379. * Memory leak in Schematron with libxml2 >= 2.6.31.
  380. * lxml.etree accepted non well-formed namespace prefix names.
  381. Other changes
  382. -------------
  383. * Major cleanup in internal ``moveNodeToDocument()`` function, which
  384. takes care of namespace cleanup when moving elements between
  385. different namespace contexts.
  386. * New Elements created through the ``makeelement()`` method of an HTML
  387. parser or through lxml.html now end up in a new HTML document
  388. (doctype HTML 4.01 Transitional) instead of a generic XML document.
  389. This mostly impacts the serialisation and the availability of a DTD
  390. context.
  391. 2.0.4 (2008-04-13)
  392. ==================
  393. Features added
  394. --------------
  395. Bugs fixed
  396. ----------
  397. * Hanging thread in conjunction with GTK threading.
  398. * Crash bug in iterparse when moving elements into other documents.
  399. * HTML elements' ``.cssselect()`` method was broken.
  400. * ``ElementTree.find*()`` didn't accept QName objects.
  401. Other changes
  402. -------------
  403. 2.1alpha1 (2008-03-27)
  404. ======================
  405. Features added
  406. --------------
  407. * New event types 'comment' and 'pi' in ``iterparse()``.
  408. * ``XSLTAccessControl`` instances have a property ``options`` that
  409. returns a dict of access configuration options.
  410. * Constant instances ``DENY_ALL`` and ``DENY_WRITE`` on
  411. ``XSLTAccessControl`` class.
  412. * Extension elements for XSLT (experimental!)
  413. * ``Element.base`` property returns the xml:base or HTML base URL of
  414. an Element.
  415. * ``docinfo.URL`` property is writable.
  416. Bugs fixed
  417. ----------
  418. * Default encoding for plain text serialisation was different from
  419. that of XML serialisation (UTF-8 instead of ASCII).
  420. Other changes
  421. -------------
  422. * Minor API speed-ups.
  423. * The benchmark suite now uses tail text in the trees, which makes the
  424. absolute numbers incomparable to previous results.
  425. * Generating the HTML documentation now requires Pygments_, which is
  426. used to enable syntax highlighting for the doctest examples.
  427. .. _Pygments: http://pygments.org/
  428. Most long-time deprecated functions and methods were removed:
  429. - ``etree.clearErrorLog()``, use ``etree.clear_error_log()``
  430. - ``etree.useGlobalPythonLog()``, use
  431. ``etree.use_global_python_log()``
  432. - ``etree.ElementClassLookup.setFallback()``, use
  433. ``etree.ElementClassLookup.set_fallback()``
  434. - ``etree.getDefaultParser()``, use ``etree.get_default_parser()``
  435. - ``etree.setDefaultParser()``, use ``etree.set_default_parser()``
  436. - ``etree.setElementClassLookup()``, use
  437. ``etree.set_element_class_lookup()``
  438. Note that ``parser.setElementClassLookup()`` has not been removed
  439. yet, although ``parser.set_element_class_lookup()`` should be used
  440. instead.
  441. - ``xpath_evaluator.registerNamespace()``, use
  442. ``xpath_evaluator.register_namespace()``
  443. - ``xpath_evaluator.registerNamespaces()``, use
  444. ``xpath_evaluator.register_namespaces()``
  445. - ``objectify.setPytypeAttributeTag``, use
  446. ``objectify.set_pytype_attribute_tag``
  447. - ``objectify.setDefaultParser()``, use
  448. ``objectify.set_default_parser()``
  449. 2.0.3 (2008-03-26)
  450. ==================
  451. Features added
  452. --------------
  453. * soupparser.parse() allows passing keyword arguments on to
  454. BeautifulSoup.
  455. * ``fromstring()`` method in ``lxml.html.soupparser``.
  456. Bugs fixed
  457. ----------
  458. * ``lxml.html.diff`` didn't treat empty tags properly (e.g.,
  459. ``<br>``).
  460. * Handle entity replacements correctly in target parser.
  461. * Crash when using ``iterparse()`` with XML Schema validation.
  462. * The BeautifulSoup parser (soupparser.py) did not replace entities,
  463. which made them turn up in text content.
  464. * Attribute assignment of custom PyTypes in objectify could fail to
  465. correctly serialise the value to a string.
  466. Other changes
  467. -------------
  468. * ``lxml.html.ElementSoup`` was replaced by a new module
  469. ``lxml.html.soupparser`` with a more consistent API. The old module
  470. remains for compatibility with ElementTree's own ElementSoup module.
  471. * Setting the XSLT_CONFIG and XML2_CONFIG environment variables at
  472. build time will let setup.py pick up the ``xml2-config`` and
  473. ``xslt-config`` scripts from the supplied path name.
  474. * Passing ``--with-xml2-config=/path/to/xml2-config`` to setup.py will
  475. override the ``xml2-config`` script that is used to determine the C
  476. compiler options. The same applies for the ``--with-xslt-config``
  477. option.
  478. 2.0.2 (2008-02-22)
  479. ==================
  480. Features added
  481. --------------
  482. * Support passing ``base_url`` to file parser functions to override
  483. the filename of the file(-like) object.
  484. Bugs fixed
  485. ----------
  486. * The prefix for objectify's pytype namespace was missing from the set
  487. of default prefixes.
  488. * Memory leak in Schematron (fixed only for libxml2 2.6.31+).
  489. * Error type names in RelaxNG were reported incorrectly.
  490. * Slice deletion bug fixed in objectify.
  491. Other changes
  492. -------------
  493. * Enabled doctests for some Python modules (especially ``lxml.html``).
  494. * Add a ``method`` argument to ``lxml.html.tostring()``
  495. (``method="xml"`` for XHTML output).
  496. * Make it clearer that methods like ``lxml.html.fromstring()`` take a
  497. ``base_url`` argument.
  498. 2.0.1 (2008-02-13)
  499. ==================
  500. Features added
  501. --------------
  502. * Child iteration in ``lxml.pyclasslookup``.
  503. * Loads of new docstrings reflect the signature of functions and
  504. methods to make them visible in API docs and ``help()``
  505. Bugs fixed
  506. ----------
  507. * The module ``lxml.html.builder`` was duplicated as
  508. ``lxml.htmlbuilder``
  509. * Form elements would return None for ``form.fields.keys()`` if there
  510. was an unnamed input field. Now unnamed input fields are completely
  511. ignored.
  512. * Setting an element slice in objectify could insert slice-overlapping
  513. elements at the wrong position.
  514. Other changes
  515. -------------
  516. * The generated API documentation was cleaned up and disburdened from
  517. non-public classes etc.
  518. * The previously public module ``lxml.html.setmixin`` was renamed to
  519. ``lxml.html._setmixin`` as it is not an official part of lxml. If
  520. you want to use it, feel free to copy it over to your own source
  521. base.
  522. * Passing ``--with-xslt-config=/path/to/xslt-config`` to setup.py will
  523. override the ``xslt-config`` script that is used to determine the C
  524. compiler options.
  525. 2.0 (2008-02-01)
  526. ================
  527. Features added
  528. --------------
  529. * Passing the ``unicode`` type as ``encoding`` to ``tostring()`` will
  530. serialise to unicode. The ``tounicode()`` function is now
  531. deprecated.
  532. * ``XMLSchema()`` and ``RelaxNG()`` can parse from StringIO.
  533. * ``makeparser()`` function in ``lxml.objectify`` to create a new
  534. parser with the usual objectify setup.
  535. * Plain ASCII XPath string results are no longer forced into unicode
  536. objects as in 2.0beta1, but are returned as plain strings as before.
  537. * All XPath string results are 'smart' objects that have a
  538. ``getparent()`` method to retrieve their parent Element.
  539. * ``with_tail`` option in serialiser functions.
  540. * More accurate exception messages in validator creation.
  541. * Parse-time XML schema validation (``schema`` parser keyword).
  542. * XPath string results of the ``text()`` function and attribute
  543. selection make their Element container accessible through a
  544. ``getparent()`` method. As a side-effect, they are now always
  545. unicode objects (even ASCII strings).
  546. * ``XSLT`` objects are usable in any thread - at the cost of a deep
  547. copy if they were not created in that thread.
  548. * Invalid entity names and character references will be rejected by
  549. the ``Entity()`` factory.
  550. * ``entity.text`` returns the textual representation of the entity,
  551. e.g. ``&amp;``.
  552. * New properties ``position`` and ``code`` on ParseError exception (as
  553. in ET 1.3)
  554. * Rich comparison of ``element.attrib`` proxies.
  555. * ElementTree compatible TreeBuilder class.
  556. * Use default prefixes for some common XML namespaces.
  557. * ``lxml.html.clean.Cleaner`` now allows for a ``host_whitelist``, and
  558. two overridable methods: ``allow_embedded_url(el, url)`` and the
  559. more general ``allow_element(el)``.
  560. * Extended slicing of Elements as in ``element[1:-1:2]``, both in
  561. etree and in objectify
  562. * Resolvers can now provide a ``base_url`` keyword argument when
  563. resolving a document as string data.
  564. * When using ``lxml.doctestcompare`` you can give the doctest option
  565. ``NOPARSE_MARKUP`` (like ``# doctest: +NOPARSE_MARKUP``) to suppress
  566. the special checking for one test.
  567. * Separate ``feed_error_log`` property for the feed parser interface.
  568. The normal parser interface and ``iterparse`` continue to use
  569. ``error_log``.
  570. * The normal parsers and the feed parser interface are now separated
  571. and can be used concurrently on the same parser instance.
  572. * ``fromstringlist()`` and ``tostringlist()`` functions as in
  573. ElementTree 1.3
  574. * ``iterparse()`` accepts an ``html`` boolean keyword argument for
  575. parsing with the HTML parser (note that this interface may be
  576. subject to change)
  577. * Parsers accept an ``encoding`` keyword argument that overrides the encoding
  578. of the parsed documents.
  579. * New C-API function ``hasChild()`` to test for children
  580. * ``annotate()`` function in objectify can annotate with Python types and XSI
  581. types in one step. Accompanied by ``xsiannotate()`` and ``pyannotate()``.
  582. * ``ET.write()``, ``tostring()`` and ``tounicode()`` now accept a keyword
  583. argument ``method`` that can be one of 'xml' (or None), 'html' or 'text' to
  584. serialise as XML, HTML or plain text content.
  585. * ``iterfind()`` method on Elements returns an iterator equivalent to
  586. ``findall()``
  587. * ``itertext()`` method on Elements
  588. * Setting a QName object as value of the .text property or as an attribute
  589. will resolve its prefix in the respective context
  590. * ElementTree-like parser target interface as described in
  591. http://effbot.org/elementtree/elementtree-xmlparser.htm
  592. * ElementTree-like feed parser interface on XMLParser and HTMLParser
  593. (``feed()`` and ``close()`` methods)
  594. * Reimplemented ``objectify.E`` for better performance and improved
  595. integration with objectify. Provides extended type support based on
  596. registered PyTypes.
  597. * XSLT objects now support deep copying
  598. * New ``makeSubElement()`` C-API function that allows creating a new
  599. subelement straight with text, tail and attributes.
  600. * XPath extension functions can now access the current context node
  601. (``context.context_node``) and use a context dictionary
  602. (``context.eval_context``) from the context provided in their first
  603. parameter
  604. * HTML tag soup parser based on BeautifulSoup in ``lxml.html.ElementSoup``
  605. * New module ``lxml.doctestcompare`` by Ian Bicking for writing simplified
  606. doctests based on XML/HTML output. Use by importing ``lxml.usedoctest`` or
  607. ``lxml.html.usedoctest`` from within a doctest.
  608. * New module ``lxml.cssselect`` by Ian Bicking for selecting Elements with CSS
  609. selectors.
  610. * New package ``lxml.html`` written by Ian Bicking for advanced HTML
  611. treatment.
  612. * Namespace class setup is now local to the ``ElementNamespaceClassLookup``
  613. instance and no longer global.
  614. * Schematron validation (incomplete in libxml2)
  615. * Additional ``stringify`` argument to ``objectify.PyType()`` takes a
  616. conversion function to strings to support setting text values from arbitrary
  617. types.
  618. * Entity support through an ``Entity`` factory and element classes. XML
  619. parsers now have a ``resolve_entities`` keyword argument that can be set to
  620. False to keep entities in the document.
  621. * ``column`` field on error log entries to accompany the ``line`` field
  622. * Error specific messages in XPath parsing and evaluation
  623. NOTE: for evaluation errors, you will now get an XPathEvalError instead of
  624. an XPathSyntaxError. To catch both, you can except on ``XPathError``
  625. * The regular expression functions in XPath now support passing a node-set
  626. instead of a string
  627. * Extended type annotation in objectify: new ``xsiannotate()`` function
  628. * EXSLT RegExp support in standard XPath (not only XSLT)
  629. Bugs fixed
  630. ----------
  631. * Missing import in ``lxml.html.clean``.
  632. * Some Python 2.4-isms prevented lxml from building/running under
  633. Python 2.3.
  634. * XPath on ElementTrees could crash when selecting the virtual root
  635. node of the ElementTree.
  636. * Compilation ``--without-threading`` was buggy in alpha5/6.
  637. * Memory leak in the ``parse()`` function.
  638. * Minor bugs in XSLT error message formatting.
  639. * Result document memory leak in target parser.
  640. * Target parser failed to report comments.
  641. * In the ``lxml.html`` ``iter_links`` method, links in ``<object>``
  642. tags weren't recognized. (Note: plugin-specific link parameters
  643. still aren't recognized.) Also, the ``<embed>`` tag, though not
  644. standard, is now included in ``lxml.html.defs.special_inline_tags``.
  645. * Using custom resolvers on XSLT stylesheets parsed from a string
  646. could request ill-formed URLs.
  647. * With ``lxml.doctestcompare`` if you do ``<tag xmlns="...">`` in your
  648. output, it will then be namespace-neutral (before the ellipsis was
  649. treated as a real namespace).
  650. * AttributeError in feed parser on parse errors
  651. * XML feed parser setup problem
  652. * Type annotation for unicode strings in ``DataElement()``
  653. * lxml failed to serialise namespace declarations of elements other than the
  654. root node of a tree
  655. * Race condition in XSLT where the resolver context leaked between concurrent
  656. XSLT calls
  657. * lxml.etree did not check tag/attribute names
  658. * The XML parser did not report undefined entities as error
  659. * The text in exceptions raised by XML parsers, validators and XPath
  660. evaluators now reports the first error that occurred instead of the last
  661. * Passing '' as XPath namespace prefix did not raise an error
  662. * Thread safety in XPath evaluators
  663. Other changes
  664. -------------
  665. * Exceptions carry only the part of the error log that is related to
  666. the operation that caused the error.
  667. * ``XMLSchema()`` and ``RelaxNG()`` now enforce passing the source
  668. file/filename through the ``file`` keyword argument.
  669. * The test suite now skips most doctests under Python 2.3.
  670. * ``make clean`` no longer removes the .c files (use ``make
  671. realclean`` instead)
  672. * Minor performance tweaks for Element instantiation and subelement
  673. creation
  674. * Various places in the XPath, XSLT and iteration APIs now require
  675. keyword-only arguments.
  676. * The argument order in ``element.itersiblings()`` was changed to
  677. match the order used in all other iteration methods. The second
  678. argument ('preceding') is now a keyword-only argument.
  679. * The ``getiterator()`` method on Elements and ElementTrees was
  680. reverted to return an iterator as it did in lxml 1.x. The ET API
  681. specification allows it to return either a sequence or an iterator,
  682. and it traditionally returned a sequence in ET and an iterator in
  683. lxml. However, it is now deprecated in favour of the ``iter()``
  684. method, which should be used in new code wherever possible.
  685. * The 'pretty printed' serialisation of ElementTree objects now
  686. inserts newlines at the root level between processing instructions,
  687. comments and the root tag.
  688. * A 'pretty printed' serialisation is now terminated with a newline.
  689. * Second argument to ``lxml.etree.Extension()`` helper is no longer
  690. required, third argument is now a keyword-only argument ``ns``.
  691. * ``lxml.html.tostring`` takes an ``encoding`` argument.
  692. * The module source files were renamed to "lxml.*.pyx", such as
  693. "lxml.etree.pyx". This was changed for consistency with the way
  694. Pyrex commonly handles package imports. The main effect is that
  695. classes now know about their fully qualified class name, including
  696. the package name of their module.
  697. * Keyword-only arguments in some API functions, especially in the
  698. parsers and serialisers.
  699. * Tag name validation in lxml.etree (and lxml.html) now distinguishes
  700. between HTML tags and XML tags based on the parser that was used to
  701. parse or create them. HTML tags no longer reject any non-ASCII
  702. characters in tag names but only spaces and the special characters
  703. ``<>&/"'``.
  704. * lxml.etree now emits a warning if you use XPath with libxml2 2.6.27
  705. (which can crash on certain XPath errors)
  706. * Type annotation in objectify now preserves the already annotated type by
  707. default to prevent loosing type information that is already there.
  708. * ``element.getiterator()`` returns a list, use ``element.iter()`` to retrieve
  709. an iterator (ElementTree 1.3 compatible behaviour)
  710. * objectify.PyType for None is now called "NoneType"
  711. * ``el.getiterator()`` renamed to ``el.iter()``, following ElementTree 1.3 -
  712. original name is still available as alias
  713. * In the public C-API, ``findOrBuildNodeNs()`` was replaced by the more
  714. generic ``findOrBuildNodeNsPrefix``
  715. * Major refactoring in XPath/XSLT extension function code
  716. * Network access in parsers disabled by default
  717. 1.3.6 (2007-10-29)
  718. ==================
  719. Bugs fixed
  720. ----------
  721. * Backported decref crash fix from 2.0
  722. * Well hidden free-while-in-use crash bug in ObjectPath
  723. Other changes
  724. -------------
  725. * The test suites now run ``gc.collect()`` in the ``tearDown()``
  726. methods. While this makes them take a lot longer to run, it also
  727. makes it easier to link a specific test to garbage collection
  728. problems that would otherwise appear in later tests.
  729. 1.3.5 (2007-10-22)
  730. ==================
  731. Features added
  732. --------------
  733. Bugs fixed
  734. ----------
  735. * lxml.etree could crash when adding more than 10000 namespaces to a
  736. document
  737. * lxml failed to serialise namespace declarations of elements other
  738. than the root node of a tree
  739. 1.3.4 (2007-08-30)
  740. ==================
  741. Features added
  742. --------------
  743. * The ``ElementMaker`` in ``lxml.builder`` now accepts the keyword arguments
  744. ``namespace`` and ``nsmap`` to set a namespace and nsmap for the Elements it
  745. creates.
  746. * The ``docinfo`` on ElementTree objects has new properties ``internalDTD``
  747. and ``externalDTD`` that return a DTD object for the internal or external
  748. subset of the document respectively.
  749. * Serialising an ElementTree now includes any internal DTD subsets that are
  750. part of the document, as well as comments and PIs that are siblings of the
  751. root node.
  752. Bugs fixed
  753. ----------
  754. * Parsing with the ``no_network`` option could fail
  755. Other changes
  756. -------------
  757. * lxml now raises a TagNameWarning about tag names containing ':' instead of
  758. an Error as 1.3.3 did. The reason is that a number of projects currently
  759. misuse the previous lack of tag name validation to generate namespace
  760. prefixes without declaring namespaces. Apart from the danger of generating
  761. broken XML this way, it also breaks most of the namespace-aware tools in
  762. XML, including XPath, XSLT and validation. lxml 1.3.x will continue to
  763. support this bug with a Warning, while lxml 2.0 will be strict about
  764. well-formed tag names (not only regarding ':').
  765. * Serialising an Element no longer includes its comment and PI siblings (only
  766. ElementTree serialisation includes them).
  767. 1.3.3 (2007-07-26)
  768. ==================
  769. Features added
  770. --------------
  771. * ElementTree compatible parser ``ETCompatXMLParser`` strips processing
  772. instructions and comments while parsing XML
  773. * Parsers now support stripping PIs (keyword argument 'remove_pis')
  774. * ``etree.fromstring()`` now supports parsing both HTML and XML, depending on
  775. the parser you pass.
  776. * Support ``base_url`` keyword argument in ``HTML()`` and ``XML()``
  777. Bugs fixed
  778. ----------
  779. * Parsing from Python Unicode strings failed on some platforms
  780. * ``Element()`` did not raise an exception on tag names containing ':'
  781. * ``Element.getiterator(tag)`` did not accept ``Comment`` and
  782. ``ProcessingInstruction`` as tags. It also accepts ``Element`` now.
  783. 1.3.2 (2007-07-03)
  784. ==================
  785. Features added
  786. --------------
  787. Bugs fixed
  788. ----------
  789. * "deallocating None" crash bug
  790. 1.3.1 (2007-07-02)
  791. ==================
  792. Features added
  793. --------------
  794. * objectify.DataElement now supports setting values from existing data
  795. elements (not just plain Python types) and reuses defined namespaces etc.
  796. * E-factory support for lxml.objectify (``objectify.E``)
  797. Bugs fixed
  798. ----------
  799. * Better way to prevent crashes in Element proxy cleanup code
  800. * objectify.DataElement didn't set up None value correctly
  801. * objectify.DataElement didn't check the value against the provided type hints
  802. * Reference-counting bug in ``Element.attrib.pop()``
  803. 1.3 (2007-06-24)
  804. ================
  805. Features added
  806. --------------
  807. * Module ``lxml.pyclasslookup`` module implements an Element class lookup
  808. scheme that can access the entire tree in read-only mode to help determining
  809. a suitable Element class
  810. * Parsers take a ``remove_comments`` keyword argument that skips over comments
  811. * ``parse()`` function in ``objectify``, corresponding to ``XML()`` etc.
  812. * ``Element.addnext(el)`` and ``Element.addprevious(el)`` methods to support
  813. adding processing instructions and comments around the root node
  814. * ``Element.attrib`` was missing ``clear()`` and ``pop()`` methods
  815. * Extended type annotation in objectify: cleaner annotation namespace setup
  816. plus new ``deannotate()`` function
  817. * Support for custom Element class instantiation in lxml.sax: passing a
  818. ``makeelement`` function to the ElementTreeContentHandler will reuse the
  819. lookup context of that function
  820. * '.' represents empty ObjectPath (identity)
  821. * ``Element.values()`` to accompany the existing ``.keys()`` and ``.items()``
  822. * ``collectAttributes()`` C-function to build a list of attribute
  823. keys/values/items for a libxml2 node
  824. * ``DTD`` validator class (like ``RelaxNG`` and ``XMLSchema``)
  825. * HTML generator helpers by Fredrik Lundh in ``lxml.htmlbuilder``
  826. * ``ElementMaker`` XML generator by Fredrik Lundh in ``lxml.builder.E``
  827. * Support for pickeling ``objectify.ObjectifiedElement`` objects to XML
  828. * ``update()`` method on Element.attrib
  829. * Optimised replacement for libxml2's _xmlReconsiliateNs(). This allows lxml
  830. a better handling of namespaces when moving elements between documents.
  831. Bugs fixed
  832. ----------
  833. * Removing Elements from a tree could make them loose their namespace
  834. declarations
  835. * ``ElementInclude`` didn't honour base URL of original document
  836. * Replacing the children slice of an Element would cut off the tails of the
  837. original children
  838. * ``Element.getiterator(tag)`` did not accept ``Comment`` and
  839. ``ProcessingInstruction`` as tags
  840. * API functions now check incoming strings for XML conformity. Zero bytes or
  841. low ASCII characters are no longer accepted (AssertionError).
  842. * XSLT parsing failed to pass resolver context on to imported documents
  843. * passing '' as namespace prefix in nsmap could be passed through to libxml2
  844. * Objectify couldn't handle prefixed XSD type names in ``xsi:type``
  845. * More ET compatible behaviour when writing out XML declarations or not
  846. * More robust error handling in ``iterparse()``
  847. * Documents lost their top-level PIs and comments on serialisation
  848. * lxml.sax failed on comments and PIs. Comments are now properly ignored and
  849. PIs are copied.
  850. * Possible memory leaks in namespace handling when moving elements between
  851. documents
  852. Other changes
  853. -------------
  854. * major restructuring in the documentation
  855. 1.2.1 (2007-02-27)
  856. ==================
  857. Bugs fixed
  858. ----------
  859. * Build fixes for MS compiler
  860. * Item assignments to special names like ``element["text"]`` failed
  861. * Renamed ObjectifiedDataElement.__setText() to _setText() to make it easier
  862. to access
  863. * The pattern for attribute names in ObjectPath was too restrictive
  864. 1.2 (2007-02-20)
  865. ================
  866. Features added
  867. --------------
  868. * Rich comparison of QName objects
  869. * Support for regular expressions in benchmark selection
  870. * get/set emulation (not .attrib!) for attributes on processing instructions
  871. * ElementInclude Python module for ElementTree compatible XInclude processing
  872. that honours custom resolvers registered with the source document
  873. * ElementTree.parser property holds the parser used to parse the document
  874. * setup.py has been refactored for greater readability and flexibility
  875. * --rpath flag to setup.py to induce automatic linking-in of dynamic library
  876. runtime search paths has been renamed to --auto-rpath. This makes it
  877. possible to pass an --rpath directly to distutils; previously this was being
  878. shadowed.
  879. Bugs fixed
  880. ----------
  881. * Element instantiation now uses locks to prevent race conditions with threads
  882. * ElementTree.write() did not raise an exception when the file was not writable
  883. * Error handling could crash under Python <= 2.4.1 - fixed by disabling thread
  884. support in these environments
  885. * Element.find*() did not accept QName objects as path
  886. Other changes
  887. -------------
  888. * code cleanup: redundant _NodeBase super class merged into _Element class
  889. Note: although the impact should be zero in most cases, this change breaks
  890. the compatibiliy of the public C-API
  891. 1.1.2 (2006-10-30)
  892. ==================
  893. Features added
  894. --------------
  895. * Data elements in objectify support repr(), which is now used by dump()
  896. * Source distribution now ships with a patched Pyrex
  897. * New C-API function makeElement() to create new elements with text,
  898. tail, attributes and namespaces
  899. * Reuse original parser flags for XInclude
  900. * Simplified support for handling XSLT processing instructions
  901. Bugs fixed
  902. ----------
  903. * Parser resources were not freed before the next parser run
  904. * Open files and XML strings returned by Python resolvers were not
  905. closed/freed
  906. * Crash in the IDDict returned by XMLDTDID
  907. * Copying Comments and ProcessingInstructions failed
  908. * Memory leak for external URLs in _XSLTProcessingInstruction.parseXSL()
  909. * Memory leak when garbage collecting tailed root elements
  910. * HTML script/style content was not propagated to .text
  911. * Show text xincluded between text nodes correctly in .text and .tail
  912. * 'integer * objectify.StringElement' operation was not supported
  913. 1.1.1 (2006-09-21)
  914. ==================
  915. Features added
  916. --------------
  917. * XSLT profiling support (``profile_run`` keyword)
  918. * countchildren() method on objectify.ObjectifiedElement
  919. * Support custom elements for tree nodes in lxml.objectify
  920. Bugs fixed
  921. ----------
  922. * lxml.objectify failed to support long data values (e.g., "123L")
  923. * Error messages from XSLT did not reach ``XSLT.error_log``
  924. * Factories objectify.Element() and objectify.DataElement() were missing
  925. ``attrib`` and ``nsmap`` keyword arguments
  926. * Changing the default parser in lxml.objectify did not update the factories
  927. Element() and DataElement()
  928. * Let lxml.objectify.Element() always generate tree elements (not data
  929. elements)
  930. * Build under Windows failed ('\0' bug in patched Pyrex version)
  931. 1.1 (2006-09-13)
  932. ================
  933. Features added
  934. --------------
  935. * Comments and processing instructions return '<!-- coment -->' and
  936. '<?pi-target content?>' for repr()
  937. * Parsers are now the preferred (and default) place where element class lookup
  938. schemes should be registered. Namespace lookup is no longer supported by
  939. default.
  940. * Support for Python 2.5 beta
  941. * Unlock the GIL for deep copying documents and for XPath()
  942. * New ``compact`` keyword argument for parsing read-only documents
  943. * Support for parser options in iterparse()
  944. * The ``namespace`` axis is supported in XPath and returns (prefix, URI)
  945. tuples
  946. * The XPath expression "/" now returns an empty list instead of raising an
  947. exception
  948. * XML-Object API on top of lxml (lxml.objectify)
  949. * Customizable Element class lookup:
  950. * different pre-implemented lookup mechanisms
  951. * support for externally provided lookup functions
  952. * Support for processing instructions (ET-like, not compatible)
  953. * Public C-level API for independent extension modules
  954. * Module level ``iterwalk()`` function as 'iterparse' for trees
  955. * Module level ``iterparse()`` function similar to ElementTree (see
  956. documentation for differences)
  957. * Element.nsmap property returns a mapping of all namespace prefixes known at
  958. the Element to their namespace URI
  959. * Reentrant threading support in RelaxNG, XMLSchema and XSLT
  960. * Threading support in parsers and serializers:
  961. * All in-memory operations (tostring, parse(StringIO), etc.) free the GIL
  962. * File operations (on file names) free the GIL
  963. * Reading from file-like objects frees the GIL and reacquires it for reading
  964. * Serialisation to file-like objects is single-threaded (high lock overhead)
  965. * Element iteration over XPath axes:
  966. * Element.iterdescendants() iterates over the descendants of an element
  967. * Element.iterancestors() iterates over the ancestors of an element (from
  968. parent to parent)
  969. * Element.itersiblings() iterates over either the following or preceding
  970. siblings of an element
  971. * Element.iterchildren() iterates over the children of an element in either
  972. direction
  973. * All iterators support the ``tag`` keyword argument to restrict the
  974. generated elements
  975. * Element.getnext() and Element.getprevious() return the direct siblings of an
  976. element
  977. Bugs fixed
  978. ----------
  979. * filenames with local 8-bit encoding were not supported
  980. * 1.1beta did not compile under Python 2.3
  981. * ignore unknown 'pyval' attribute values in objectify
  982. * objectify.ObjectifiedElement.addattr() failed to accept Elements and Lists
  983. * objectify.ObjectPath.setattr() failed to accept Elements and Lists
  984. * XPathSyntaxError now inherits from XPathError
  985. * Threading race conditions in RelaxNG and XMLSchema
  986. * Crash when mixing elements from XSLT results into other trees, concurrent
  987. XSLT is only allowed when the stylesheet was parsed in the main thread
  988. * The EXSLT ``regexp:match`` function now works as defined (except for some
  989. differences in the regular expression syntax)
  990. * Setting element.text to '' returned None on request, not the empty string
  991. * ``iterparse()`` could crash on long XML files
  992. * Creating documents no longer copies the parser for later URL resolving. For
  993. performance reasons, only a reference is kept. Resolver updates on the
  994. parser will now be reflected by documents that were parsed before the
  995. change. Although this should rarely become visible, it is a behavioral
  996. change from 1.0.
  997. 1.0.4 (2006-09-09)
  998. ==================
  999. Features added
  1000. --------------
  1001. * List-like ``Element.extend()`` method
  1002. Bugs fixed
  1003. ----------
  1004. * Crash in tail handling in ``Element.replace()``
  1005. 1.0.3 (2006-08-08)
  1006. ==================
  1007. Features added
  1008. --------------
  1009. * Element.replace(old, new) method to replace a subelement by another one
  1010. Bugs fixed
  1011. ----------
  1012. * Crash when mixing elements from XSLT results into other trees
  1013. * Copying/deepcopying did not work for ElementTree objects
  1014. * Setting an attribute to a non-string value did not raise an exception
  1015. * Element.remove() deleted the tail text from the removed Element
  1016. 1.0.2 (2006-06-27)
  1017. ==================
  1018. Features added
  1019. --------------
  1020. * Support for setting a custom default Element class as opposed to namespace
  1021. specific classes (which still override the default class)
  1022. Bugs fixed
  1023. ----------
  1024. * Rare exceptions in Python list functions were not handled
  1025. * Parsing accepted unicode strings with XML encoding declaration in certain
  1026. cases
  1027. * Parsing 8-bit encoded strings from StringIO objects raised an exception
  1028. * Module function ``initThread()`` was removed - useless (and never worked)
  1029. * XSLT and parser exception messages include the error line number
  1030. 1.0.1 (2006-06-09)
  1031. ==================
  1032. Features added
  1033. --------------
  1034. * Repeated calls to Element.attrib now efficiently return the same instance
  1035. Bugs fixed
  1036. ----------
  1037. * Document deallocation could crash in certain garbage collection scenarios
  1038. * Extension function calls in XSLT variable declarations could break the
  1039. stylesheet and crash on repeated calls
  1040. * Deep copying Elements could loose namespaces declared in parents
  1041. * Deep copying Elements did not copy tail
  1042. * Parsing file(-like) objects failed to load external entities
  1043. * Parsing 8-bit strings from file(-like) objects raised an exception
  1044. * xsl:include failed when the stylesheet was parsed from a file-like object
  1045. * lxml.sax.ElementTreeProducer did not call startDocument() / endDocument()
  1046. * MSVC compiler complained about long strings (supports only 2048 bytes)
  1047. 1.0 (2006-06-01)
  1048. ================
  1049. Features added
  1050. --------------
  1051. * Element.getiterator() and the findall() methods support finding arbitrary
  1052. elements from a namespace (pattern ``{namespace}*``)
  1053. * Another speedup in tree iteration code
  1054. * General speedup of Python Element object creation and deallocation
  1055. * Writing C14N no longer serializes in memory (reduced memory footprint)
  1056. * PyErrorLog for error logging through the Python ``logging`` module
  1057. * ``Element.getroottree()`` returns an ElementTree for the root node of the
  1058. document that contains the element.
  1059. * ElementTree.getpath(element) returns a simple, absolute XPath expression to
  1060. find the element in the tree structure
  1061. * Error logs have a ``last_error`` attribute for convenience
  1062. * Comment texts can be changed through the API
  1063. * Formatted output via ``pretty_print`` keyword in serialization functions
  1064. * XSLT can block access to file system and network via ``XSLTAccessControl``
  1065. * ElementTree.write() no longer serializes in memory (reduced memory
  1066. footprint)
  1067. * Speedup of Element.findall(tag) and Element.getiterator(tag)
  1068. * Support for writing the XML representation of Elements and ElementTrees to
  1069. Python unicode strings via ``etree.tounicode()``
  1070. * Support for writing XSLT results to Python unicode strings via ``unicode()``
  1071. * Parsing a unicode string no longer copies the string (reduced memory
  1072. footprint)
  1073. * Parsing file-like objects reads chunks rather than the whole file (reduced
  1074. memory footprint)
  1075. * Parsing StringIO objects from the start avoids copying the string (reduced
  1076. memory footprint)
  1077. * Read-only 'docinfo' attribute in ElementTree class holds DOCTYPE
  1078. information, original encoding and XML version as seen by the parser
  1079. * etree module can be compiled without libxslt by commenting out the line
  1080. ``include "xslt.pxi"`` near the end of the etree.pyx source file
  1081. * Better error messages in parser exceptions
  1082. * Error reporting also works in XSLT
  1083. * Support for custom document loaders (URI resolvers) in parsers and XSLT,
  1084. resolvers are registered at parser level
  1085. * Implementation of exslt:regexp for XSLT based on the Python 're' module,
  1086. enabled by default, can be switched off with 'regexp=False' keyword argument
  1087. * Support for exslt extensions (libexslt) and libxslt extra functions
  1088. (node-set, document, write, output)
  1089. * Substantial speedup in XPath.evaluate()
  1090. * HTMLParser for parsing (broken) HTML
  1091. * XMLDTDID function parses XML into tuple (root node, ID dict) based on xml:id
  1092. implementation of libxml2 (as opposed to ET compatible XMLID)
  1093. Bugs fixed
  1094. ----------
  1095. * Memory leak in Element.__setitem__
  1096. * Memory leak in Element.attrib.items() and Element.attrib.values()
  1097. * Memory leak in XPath extension functions
  1098. * Memory leak in unicode related setup code
  1099. * Element now raises ValueError on empty tag names
  1100. * Namespace fixing after moving elements between documents could fail if the
  1101. source document was freed too early
  1102. * Setting namespace-less tag names on namespaced elements ('{ns}t' -> 't')
  1103. didn't reset the namespace
  1104. * Unknown constants from newer libxml2 versions could raise exceptions in the
  1105. error handlers
  1106. * lxml.etree compiles much faster
  1107. * On libxml2 <= 2.6.22, parsing strings with encoding declaration could fail
  1108. in certain cases
  1109. * Document reference in ElementTree objects was not updated when the root
  1110. element was moved to a different document
  1111. * Running absolute XPath expressions on an Element now evaluates against the
  1112. root tree
  1113. * Evaluating absolute XPath expressions (``/*``) on an ElementTree could fail
  1114. * Crashes when calling XSLT, RelaxNG, etc. with uninitialized ElementTree
  1115. objects
  1116. * Removed public function ``initThreadLogging()``, replaced by more general
  1117. ``initThread()`` which fixes a number of setup problems in threads
  1118. * Memory leak when using iconv encoders in tostring/write
  1119. * Deep copying Elements and ElementTrees maintains the document information
  1120. * Serialization functions raise LookupError for unknown encodings
  1121. * Memory deallocation crash resulting from deep copying elements
  1122. * Some ElementTree methods could crash if the root node was not initialized
  1123. (neither file nor element passed to the constructor)
  1124. * Element/SubElement failed to set attribute namespaces from passed ``attrib``
  1125. dictionary
  1126. * ``tostring()`` adds an XML declaration for non-ASCII encodings
  1127. * ``tostring()`` failed to serialize encodings that contain 0-bytes
  1128. * ElementTree.xpath() and XPathDocumentEvaluator were not using the
  1129. ElementTree root node as reference point
  1130. * Calling ``document('')`` in XSLT failed to return the stylesheet
  1131. 0.9.2 (2006-05-10)
  1132. ==================
  1133. Features added
  1134. --------------
  1135. * Speedup for Element.makeelement(): the new element reuses the original
  1136. libxml2 document instead of creating a new empty one
  1137. * Speedup for reversed() iteration over element children (Py2.4+ only)
  1138. * ElementTree compatible QName class
  1139. * RelaxNG and XMLSchema accept any Element, not only ElementTrees
  1140. Bugs fixed
  1141. ----------
  1142. * str(xslt_result) was broken for XSLT output other than UTF-8
  1143. * Memory leak if write_c14n fails to write the file after conversion
  1144. * Crash in XMLSchema and RelaxNG when passing non-schema documents
  1145. * Memory leak in RelaxNG() when RelaxNGParseError is raised
  1146. 0.9.1 (2006-03-30)
  1147. ==================
  1148. Features added
  1149. --------------
  1150. * lxml.sax.ElementTreeContentHandler checks closing elements and raises
  1151. SaxError on mismatch
  1152. * lxml.sax.ElementTreeContentHandler supports namespace-less SAX events
  1153. (startElement, endElement) and defaults to empty attributes (keyword
  1154. argument)
  1155. * Speedup for repeatedly accessing element tag names
  1156. * Minor API performance improvements
  1157. Bugs fixed
  1158. ----------
  1159. * Memory deallocation bug when using XSLT output method "html"
  1160. * sax.py was handling UTF-8 encoded tag names where it shouldn't
  1161. * lxml.tests package will no longer be installed (is still in source tar)
  1162. 0.9 (2006-03-20)
  1163. ================
  1164. Features added
  1165. --------------
  1166. * Error logging API for libxml2 error messages
  1167. * Various performance improvements
  1168. * Benchmark script for lxml, ElementTree and cElementTree
  1169. * Support for registering extension functions through new FunctionNamespace
  1170. class (see doc/extensions.txt)
  1171. * ETXPath class for XPath expressions in ElementTree notation ('//{ns}tag')
  1172. * Support for variables in XPath expressions (also in XPath class)
  1173. * XPath class for compiled XPath expressions
  1174. * XMLID module level function (ElementTree compatible)
  1175. * XMLParser API for customized libxml2 parser configuration
  1176. * Support for custom Element classes through new Namespace API (see
  1177. doc/namespace_extensions.txt)
  1178. * Common exception base class LxmlError for module exceptions
  1179. * real iterator support in iter(Element), Element.getiterator()
  1180. * XSLT objects are callable, result trees support str()
  1181. * Added MANIFEST.in for easier creation of RPM files.
  1182. * 'getparent' method on elements allows navigation to an element's
  1183. parent element.
  1184. * Python core compatible SAX tree builder and SAX event generator. See
  1185. doc/sax.txt for more information.
  1186. Bugs fixed
  1187. ----------
  1188. * Segfaults and memory leaks in various API functions of Element
  1189. * Segfault in XSLT.tostring()
  1190. * ElementTree objects no longer interfere, Elements can be root of different
  1191. ElementTrees at the same time
  1192. * document('') works in XSLT documents read from files (in-memory documents
  1193. cannot support this due to libxslt deficiencies)
  1194. 0.8 (2005-11-03)
  1195. ================
  1196. Features added
  1197. --------------
  1198. * Support for copy.deepcopy() on elements. copy.copy() works also, but
  1199. does the same thing, and does *not* create a shallow copy, as that
  1200. makes no sense in the context of libxml2 trees. This means a
  1201. potential incompatibility with ElementTree, but there's more chance
  1202. that it works than if copy.copy() isn't supported at all.
  1203. * Increased compatibility with (c)ElementTree; .parse() on ElementTree is
  1204. supported and parsing of gzipped XML files works.
  1205. * implemented index() on elements, allowing one to find the index of a
  1206. SubElement.
  1207. Bugs fixed
  1208. ----------
  1209. * Use xslt-config instead of xml2-config to find out libxml2
  1210. directories to take into account a case where libxslt is installed
  1211. in a different directory than libxslt.
  1212. * Eliminate crash condition in iteration when text nodes are changed.
  1213. * Passing 'None' to tostring() does not result in a segfault anymore,
  1214. but an AssertionError.
  1215. * Some test fixes for Windows.
  1216. * Raise XMLSyntaxError and XPathSyntaxError instead of plain python
  1217. syntax errors. This should be less confusing.
  1218. * Fixed error with uncaught exception in Pyrex code.
  1219. * Calling lxml.etree.fromstring('') throws XMLSyntaxError instead of a
  1220. segfault.
  1221. * has_key() works on attrib. 'in' tests also work correctly on attrib.
  1222. * INSTALL.txt was saying 2.2.16 instead of 2.6.16 as a supported
  1223. libxml2 version, as it should.
  1224. * Passing a UTF-8 encoded string to the XML() function would fail;
  1225. fixed.
  1226. 0.7 (2005-06-15)
  1227. ================
  1228. Features added
  1229. --------------
  1230. * parameters (XPath expressions) can be passed to XSLT using keyword
  1231. parameters.
  1232. * Simple XInclude support. Calling the xinclude() method on a tree
  1233. will process any XInclude statements in the document.
  1234. * XMLSchema support. Use the XMLSchema class or the convenience
  1235. xmlschema() method on a tree to do XML Schema (XSD) validation.
  1236. * Added convenience xslt() method on tree. This is less efficient
  1237. than the XSLT object, but makes it easier to write quick code.
  1238. * Added convenience relaxng() method on tree. This is less efficient
  1239. than the RelaxNG object, but makes it easier to write quick code.
  1240. * Make it possible to use XPathEvaluator with elements as well. The
  1241. XPathEvaluator in this case will retain the element so multiple
  1242. XPath queries can be made against one element efficiently. This
  1243. replaces the second argument to the .evaluate() method that existed
  1244. previously.
  1245. * Allow registerNamespace() to be called on an XPathEvaluator, after
  1246. creation, to add additional namespaces. Also allow registerNamespaces(),
  1247. which does the same for a namespace dictionary.
  1248. * Add 'prefix' attribute to element to be able to read prefix information.
  1249. This is entirely read-only.
  1250. * It is possible to supply an extra nsmap keyword parameter to
  1251. the Element() and SubElement() constructors, which supplies a
  1252. prefix to namespace URI mapping. This will create namespace
  1253. prefix declarations on these elements and these prefixes will show up
  1254. in XML serialization.
  1255. Bugs fixed
  1256. ----------
  1257. * Killed yet another memory management related bug: trees created
  1258. using newDoc would not get a libxml2-level dictionary, which caused
  1259. problems when deallocating these documents later if they contained a
  1260. node that came from a document with a dictionary.
  1261. * Moving namespaced elements between documents was problematic as
  1262. references to the original document would remain. This has been fixed
  1263. by applying xmlReconciliateNs() after each move operation.
  1264. * Can pass None to 'dump()' without segfaults.
  1265. * tostring() works properly for non-root elements as well.
  1266. * Cleaned out the tostring() method so it should handle encoding
  1267. correctly.
  1268. * Cleaned out the ElementTree.write() method so it should handle encoding
  1269. correctly. Writing directly to a file should also be faster, as there is no
  1270. need to go through a Python string in that case. Made sure the test cases
  1271. test both serializing to StringIO as well as serializing to a real file.
  1272. 0.6 (2005-05-14)
  1273. ================
  1274. Features added
  1275. --------------
  1276. * Changed setup.py so that library_dirs is also guessed. This should
  1277. help with compilation on the Mac OS X platform, where otherwise the
  1278. wrong library (shipping with the OS) could be picked up.
  1279. * Tweaked setup.py so that it picks up the version from version.txt.
  1280. Bugs fixed
  1281. ----------
  1282. * Do the right thing when handling namespaced attributes.
  1283. * fix bug where tostring() moved nodes into new documents. tostring()
  1284. had very nasty side-effects before this fix, sorry!
  1285. 0.5.1 (2005-04-09)
  1286. ==================
  1287. * Python 2.2 compatibility fixes.
  1288. * unicode fixes in Element() and Comment() as well as XML(); unicode
  1289. input wasn't properly being UTF-8 encoded.
  1290. 0.5 (2005-04-08)
  1291. ================
  1292. Initial public release.