==============
lxml changelog
==============

1.3 (2007-06-24)
================

Features added
--------------

* Module ``lxml.pyclasslookup`` implemens an Element class lookup scheme that
  can access the entire tree to determine a suitable Element class

* Parsers take a ``remove_comments`` keyword argument that skips over comments

* ``parse()`` function in ``objectify``, corresponding to ``XML()`` etc.

* ``Element.addnext(el)`` and ``Element.addprevious(el)`` methods to support
  adding processing instructions and comments around the root node

* Extended type annotation in objectify: cleaner annotation namespace setup
  plus new ``deannotate()`` function

* Support for custom Element class instantiation in lxml.sax: passing a
  ``makeelement()`` function to the ElementTreeContentHandler will reuse the
  lookup context of that function

* '.' represents empty ObjectPath (identity)

Bugs fixed
----------

* Removing Elements from a tree could make them loose their namespace
  declarations

* ``ElementInclude`` didn't honour base URL of original document

* Replacing the children slice of an Element would cut off the tails of the
  original children

* ``Element.getiterator(tag)`` did not accept ``Comment`` and
  ``ProcessingInstruction`` as tags

* API functions now check incoming strings for XML conformity.  Zero bytes or
  low ASCII characters are no longer accepted.

* XSLT parsing failed to pass resolver context on to imported documents

* More ET compatible behaviour when writing out XML declarations or not

* ``Element.attrib`` was missing ``clear()`` and ``pop()`` methods

* More robust error handling in ``iterparse()``

* Documents lost their top-level PIs and comments on serialisation

* lxml.sax failed on comments and PIs. Comments are now properly ignored and
  PIs are copied.

* Raise AssertionError when passing strings containing '\0' bytes


1.3beta (2007-02-27)
====================

Features added
--------------

* ``DTD`` validator class (like ``RelaxNG`` and ``XMLSchema``)

* HTML generator helpers by Fredrik Lundh in ``lxml.htmlbuilder``

* ``ElementMaker`` XML generator by Fredrik Lundh in ``lxml.builder.E``

* Support for pickeling ``objectify.ObjectifiedElement`` objects to XML

* ``update()`` method on Element.attrib

* Optimised replacement for libxml2's _xmlReconsiliateNs(). This allows lxml
  a better handling of namespaces when moving elements between documents.

Bugs fixed
----------

* Possible memory leaks in namespace handling when moving elements between
  documents

Other changes
-------------

* major restructuring in the documentation


1.2.1 (2007-02-27)
==================

Bugs fixed
----------

* Build fixes for MS compiler

* Item assignments to special names like ``element["text"]`` failed

* Renamed ObjectifiedDataElement.__setText() to _setText() to make it easier
  to access

* The pattern for attribute names in ObjectPath was too restrictive


1.2 (2007-02-20)
================

Features added
--------------

* Rich comparison of QName objects

* Support for regular expressions in benchmark selection

* get/set emulation (not .attrib!) for attributes on processing instructions

* ElementInclude Python module for ElementTree compatible XInclude processing
  that honours custom resolvers registered with the source document

* ElementTree.parser property holds the parser used to parse the document

* setup.py has been refactored for greater readability and flexibility

* --rpath flag to setup.py to induce automatic linking-in of dynamic library
  runtime search paths has been renamed to --auto-rpath. This makes it
  possible to pass an --rpath directly to distutils; previously this was being
  shadowed.

Bugs fixed
----------

* Element instantiation now uses locks to prevent race conditions with threads

* ElementTree.write() did not raise an exception when the file was not writable

* Error handling could crash under Python <= 2.4.1 - fixed by disabling thread
  support in these environments

* Element.find*() did not accept QName objects as path

Other changes
-------------

* code cleanup: redundant _NodeBase super class merged into _Element class
  Note: although the impact should be zero in most cases, this change breaks
  the compatibiliy of the public C-API


1.1.2 (2006-10-30)
==================

Features added
--------------

* Data elements in objectify support repr(), which is now used by dump()

* Source distribution now ships with a patched Pyrex

* New C-API function makeElement() to create new elements with text,
  tail, attributes and namespaces

* Reuse original parser flags for XInclude

* Simplified support for handling XSLT processing instructions

Bugs fixed
----------

* Parser resources were not freed before the next parser run

* Open files and XML strings returned by Python resolvers were not
  closed/freed

* Crash in the IDDict returned by XMLDTDID

* Copying Comments and ProcessingInstructions failed

* Memory leak for external URLs in _XSLTProcessingInstruction.parseXSL()

* Memory leak when garbage collecting tailed root elements

* HTML script/style content was not propagated to .text

* Show text xincluded between text nodes correctly in .text and .tail

* 'integer * objectify.StringElement' operation was not supported


1.1.1 (2006-09-21)
==================

Features added
--------------

* XSLT profiling support (``profile_run`` keyword)

* countchildren() method on objectify.ObjectifiedElement

* Support custom elements for tree nodes in lxml.objectify

Bugs fixed
----------

* lxml.objectify failed to support long data values (e.g., "123L")

* Error messages from XSLT did not reach ``XSLT.error_log``

* Factories objectify.Element() and objectify.DataElement() were missing
  ``attrib`` and ``nsmap`` keyword arguments

* Changing the default parser in lxml.objectify did not update the factories
  Element() and DataElement()

* Let lxml.objectify.Element() always generate tree elements (not data
  elements)

* Build under Windows failed ('\0' bug in patched Pyrex version)


1.1 (2006-09-13)
================

Features added
--------------

* Comments and processing instructions return '<!-- coment -->' and
  '<?pi-target content?>' for repr()

* Parsers are now the preferred (and default) place where element class lookup
  schemes should be registered.  Namespace lookup is no longer supported by
  default.

* Support for Python 2.5 beta

* Unlock the GIL for deep copying documents and for XPath()

* New ``compact`` keyword argument for parsing read-only documents

* Support for parser options in iterparse()

* The ``namespace`` axis is supported in XPath and returns (prefix, URI)
  tuples

* The XPath expression "/" now returns an empty list instead of raising an
  exception

* XML-Object API on top of lxml (lxml.objectify)

* Customizable Element class lookup:

  * different pre-implemented lookup mechanisms

  * support for externally provided lookup functions

* Support for processing instructions (ET-like, not compatible)

* Public C-level API for independent extension modules

* Module level ``iterwalk()`` function as 'iterparse' for trees

* Module level ``iterparse()`` function similar to ElementTree (see
  documentation for differences)

* Element.nsmap property returns a mapping of all namespace prefixes known at
  the Element to their namespace URI

* Reentrant threading support in RelaxNG, XMLSchema and XSLT

* Threading support in parsers and serializers:

  * All in-memory operations (tostring, parse(StringIO), etc.) free the GIL

  * File operations (on file names) free the GIL

  * Reading from file-like objects frees the GIL and reacquires it for reading

  * Serialisation to file-like objects is single-threaded (high lock overhead)

* Element iteration over XPath axes:

  * Element.iterdescendants() iterates over the descendants of an element

  * Element.iterancestors() iterates over the ancestors of an element (from
    parent to parent)

  * Element.itersiblings() iterates over either the following or preceding
    siblings of an element

  * Element.iterchildren() iterates over the children of an element in either
    direction

  * All iterators support the ``tag`` keyword argument to restrict the
    generated elements

* Element.getnext() and Element.getprevious() return the direct siblings of an
  element

Bugs fixed
----------

* filenames with local 8-bit encoding were not supported

* 1.1beta did not compile under Python 2.3

* ignore unknown 'pyval' attribute values in objectify

* objectify.ObjectifiedElement.addattr() failed to accept Elements and Lists

* objectify.ObjectPath.setattr() failed to accept Elements and Lists

* XPathSyntaxError now inherits from XPathError

* Threading race conditions in RelaxNG and XMLSchema

* Crash when mixing elements from XSLT results into other trees, concurrent
  XSLT is only allowed when the stylesheet was parsed in the main thread

* The EXSLT ``regexp:match`` function now works as defined (except for some
  differences in the regular expression syntax)

* Setting element.text to '' returned None on request, not the empty string

* ``iterparse()`` could crash on long XML files

* Creating documents no longer copies the parser for later URL resolving.  For
  performance reasons, only a reference is kept.  Resolver updates on the
  parser will now be reflected by documents that were parsed before the
  change.  Although this should rarely become visible, it is a behavioral
  change from 1.0.


1.0.4 (2006-09-09)
==================

Features added
--------------

* List-like ``Element.extend()`` method

Bugs fixed
----------

* Crash in tail handling in ``Element.replace()``


1.0.3 (2006-08-08)
==================

Features added
--------------

* Element.replace(old, new) method to replace a subelement by another one

Bugs fixed
----------

* Crash when mixing elements from XSLT results into other trees

* Copying/deepcopying did not work for ElementTree objects

* Setting an attribute to a non-string value did not raise an exception

* Element.remove() deleted the tail text from the removed Element


1.0.2 (2006-06-27)
==================

Features added
--------------

* Support for setting a custom default Element class as opposed to namespace
  specific classes (which still override the default class)

Bugs fixed
----------

* Rare exceptions in Python list functions were not handled

* Parsing accepted unicode strings with XML encoding declaration in certain
  cases

* Parsing 8-bit encoded strings from StringIO objects raised an exception

* Module function ``initThread()`` was removed - useless (and never worked)

* XSLT and parser exception messages include the error line number


1.0.1 (2006-06-09)
==================

Features added
--------------

* Repeated calls to Element.attrib now efficiently return the same instance

Bugs fixed
----------

* Document deallocation could crash in certain garbage collection scenarios

* Extension function calls in XSLT variable declarations could break the
  stylesheet and crash on repeated calls

* Deep copying Elements could loose namespaces declared in parents

* Deep copying Elements did not copy tail

* Parsing file(-like) objects failed to load external entities

* Parsing 8-bit strings from file(-like) objects raised an exception

* xsl:include failed when the stylesheet was parsed from a file-like object

* lxml.sax.ElementTreeProducer did not call startDocument() / endDocument()

* MSVC compiler complained about long strings (supports only 2048 bytes)


1.0 (2006-06-01)
================

Features added
--------------

* Element.getiterator() and the findall() methods support finding arbitrary
  elements from a namespace (pattern ``{namespace}*``)

* Another speedup in tree iteration code

* General speedup of Python Element object creation and deallocation

* Writing C14N no longer serializes in memory (reduced memory footprint)

* PyErrorLog for error logging through the Python ``logging`` module

* ``Element.getroottree()`` returns an ElementTree for the root node of the
  document that contains the element.

* ElementTree.getpath(element) returns a simple, absolute XPath expression to
  find the element in the tree structure

* Error logs have a ``last_error`` attribute for convenience

* Comment texts can be changed through the API

* Formatted output via ``pretty_print`` keyword in serialization functions

* XSLT can block access to file system and network via ``XSLTAccessControl``

* ElementTree.write() no longer serializes in memory (reduced memory
  footprint)

* Speedup of Element.findall(tag) and Element.getiterator(tag)

* Support for writing the XML representation of Elements and ElementTrees to
  Python unicode strings via ``etree.tounicode()``

* Support for writing XSLT results to Python unicode strings via ``unicode()``

* Parsing a unicode string no longer copies the string (reduced memory
  footprint)

* Parsing file-like objects reads chunks rather than the whole file (reduced
  memory footprint)

* Parsing StringIO objects from the start avoids copying the string (reduced
  memory footprint)

* Read-only 'docinfo' attribute in ElementTree class holds DOCTYPE
  information, original encoding and XML version as seen by the parser

* etree module can be compiled without libxslt by commenting out the line
  ``include "xslt.pxi"`` near the end of the etree.pyx source file

* Better error messages in parser exceptions

* Error reporting also works in XSLT

* Support for custom document loaders (URI resolvers) in parsers and XSLT,
  resolvers are registered at parser level

* Implementation of exslt:regexp for XSLT based on the Python 're' module,
  enabled by default, can be switched off with 'regexp=False' keyword argument

* Support for exslt extensions (libexslt) and libxslt extra functions
  (node-set, document, write, output)

* Substantial speedup in XPath.evaluate()

* HTMLParser for parsing (broken) HTML

* XMLDTDID function parses XML into tuple (root node, ID dict) based on xml:id
  implementation of libxml2 (as opposed to ET compatible XMLID)

Bugs fixed
----------

* Memory leak in Element.__setitem__

* Memory leak in Element.attrib.items() and Element.attrib.values()

* Memory leak in XPath extension functions

* Memory leak in unicode related setup code

* Element now raises ValueError on empty tag names

* Namespace fixing after moving elements between documents could fail if the
  source document was freed too early

* Setting namespace-less tag names on namespaced elements ('{ns}t' -> 't')
  didn't reset the namespace

* Unknown constants from newer libxml2 versions could raise exceptions in the
  error handlers

* lxml.etree compiles much faster

* On libxml2 <= 2.6.22, parsing strings with encoding declaration could fail
  in certain cases

* Document reference in ElementTree objects was not updated when the root
  element was moved to a different document

* Running absolute XPath expressions on an Element now evaluates against the
  root tree

* Evaluating absolute XPath expressions (``/*``) on an ElementTree could fail

* Crashes when calling XSLT, RelaxNG, etc. with uninitialized ElementTree
  objects

* Removed public function ``initThreadLogging()``, replaced by more general
  ``initThread()`` which fixes a number of setup problems in threads

* Memory leak when using iconv encoders in tostring/write

* Deep copying Elements and ElementTrees maintains the document information

* Serialization functions raise LookupError for unknown encodings

* Memory deallocation crash resulting from deep copying elements

* Some ElementTree methods could crash if the root node was not initialized
  (neither file nor element passed to the constructor)

* Element/SubElement failed to set attribute namespaces from passed ``attrib``
  dictionary

* ``tostring()`` adds an XML declaration for non-ASCII encodings

* ``tostring()`` failed to serialize encodings that contain 0-bytes

* ElementTree.xpath() and XPathDocumentEvaluator were not using the
  ElementTree root node as reference point

* Calling ``document('')`` in XSLT failed to return the stylesheet


0.9.2 (2006-05-10)
==================

Features added
--------------

* Speedup for Element.makeelement(): the new element reuses the original
  libxml2 document instead of creating a new empty one

* Speedup for reversed() iteration over element children (Py2.4+ only)

* ElementTree compatible QName class

* RelaxNG and XMLSchema accept any Element, not only ElementTrees

Bugs fixed
----------

* str(xslt_result) was broken for XSLT output other than UTF-8

* Memory leak if write_c14n fails to write the file after conversion

* Crash in XMLSchema and RelaxNG when passing non-schema documents

* Memory leak in RelaxNG() when RelaxNGParseError is raised

0.9.1 (2006-03-30)
==================

Features added
--------------

* lxml.sax.ElementTreeContentHandler checks closing elements and raises
  SaxError on mismatch

* lxml.sax.ElementTreeContentHandler supports namespace-less SAX events
  (startElement, endElement) and defaults to empty attributes (keyword
  argument)

* Speedup for repeatedly accessing element tag names

* Minor API performance improvements

Bugs fixed
----------

* Memory deallocation bug when using XSLT output method "html"

* sax.py was handling UTF-8 encoded tag names where it shouldn't

* lxml.tests package will no longer be installed (is still in source tar)

0.9 (2006-03-20)
================

Features added
--------------

* Error logging API for libxml2 error messages

* Various performance improvements

* Benchmark script for lxml, ElementTree and cElementTree

* Support for registering extension functions through new FunctionNamespace
  class (see doc/extensions.txt)

* ETXPath class for XPath expressions in ElementTree notation ('//{ns}tag')

* Support for variables in XPath expressions (also in XPath class)

* XPath class for compiled XPath expressions

* XMLID module level function (ElementTree compatible)

* XMLParser API for customized libxml2 parser configuration

* Support for custom Element classes through new Namespace API (see
  doc/namespace_extensions.txt)

* Common exception base class LxmlError for module exceptions

* real iterator support in iter(Element), Element.getiterator()

* XSLT objects are callable, result trees support str()

* Added MANIFEST.in for easier creation of RPM files.

* 'getparent' method on elements allows navigation to an element's
  parent element.

* Python core compatible SAX tree builder and SAX event generator. See
  doc/sax.txt for more information.

Bugs fixed
----------

* Segfaults and memory leaks in various API functions of Element

* Segfault in XSLT.tostring()

* ElementTree objects no longer interfere, Elements can be root of different
  ElementTrees at the same time

* document('') works in XSLT documents read from files (in-memory documents
  cannot support this due to libxslt deficiencies)

0.8 (2005-11-03)
================

Features added
--------------

* Support for copy.deepcopy() on elements. copy.copy() works also, but
  does the same thing, and does *not* create a shallow copy, as that
  makes no sense in the context of libxml2 trees. This means a
  potential incompatibility with ElementTree, but there's more chance
  that it works than if copy.copy() isn't supported at all.

* Increased compatibility with (c)ElementTree; .parse() on ElementTree is
  supported and parsing of gzipped XML files works.

* implemented index() on elements, allowing one to find the index of a
  SubElement.

Bugs fixed
----------

* Use xslt-config instead of xml2-config to find out libxml2
  directories to take into account a case where libxslt is installed
  in a different directory than libxslt.

* Eliminate crash condition in iteration when text nodes are changed.

* Passing 'None' to tostring() does not result in a segfault anymore,
  but an AssertionError.

* Some test fixes for Windows.

* Raise XMLSyntaxError and XPathSyntaxError instead of plain python
  syntax errors. This should be less confusing.

* Fixed error with uncaught exception in Pyrex code.

* Calling lxml.etree.fromstring('') throws XMLSyntaxError instead of a
  segfault.

* has_key() works on attrib. 'in' tests also work correctly on attrib.

* INSTALL.txt was saying 2.2.16 instead of 2.6.16 as a supported
  libxml2 version, as it should.

* Passing a UTF-8 encoded string to the XML() function would fail;
  fixed.

0.7 (2005-06-15)
================

Features added
--------------

* parameters (XPath expressions) can be passed to XSLT using keyword
  parameters.

* Simple XInclude support. Calling the xinclude() method on a tree
  will process any XInclude statements in the document.

* XMLSchema support. Use the XMLSchema class or the convenience
  xmlschema() method on a tree to do XML Schema (XSD) validation.

* Added convenience xslt() method on tree. This is less efficient
  than the XSLT object, but makes it easier to write quick code.

* Added convenience relaxng() method on tree. This is less efficient
  than the RelaxNG object, but makes it easier to write quick code.

* Make it possible to use XPathEvaluator with elements as well. The
  XPathEvaluator in this case will retain the element so multiple
  XPath queries can be made against one element efficiently. This
  replaces the second argument to the .evaluate() method that existed
  previously.

* Allow registerNamespace() to be called on an XPathEvaluator, after
  creation, to add additional namespaces. Also allow registerNamespaces(),
  which does the same for a namespace dictionary.

* Add 'prefix' attribute to element to be able to read prefix information.
  This is entirely read-only.

* It is possible to supply an extra nsmap keyword parameter to
  the Element() and SubElement() constructors, which supplies a
  prefix to namespace URI mapping. This will create namespace
  prefix declarations on these elements and these prefixes will show up
  in XML serialization.
  
Bugs fixed
----------
 
* Killed yet another memory management related bug: trees created
  using newDoc would not get a libxml2-level dictionary, which caused
  problems when deallocating these documents later if they contained a
  node that came from a document with a dictionary.

* Moving namespaced elements between documents was problematic as 
  references to the original document would remain. This has been fixed
  by applying xmlReconciliateNs() after each move operation.

* Can pass None to 'dump()' without segfaults.

* tostring() works properly for non-root elements as well.

* Cleaned out the tostring() method so it should handle encoding
  correctly.

* Cleaned out the ElementTree.write() method so it should handle encoding
  correctly. Writing directly to a file should also be faster, as there is no
  need to go through a Python string in that case. Made sure the test cases
  test both serializing to StringIO as well as serializing to a real file.

0.6 (2005-05-14)
================

Features added
--------------

* Changed setup.py so that library_dirs is also guessed. This should
  help with compilation on the Mac OS X platform, where otherwise the
  wrong library (shipping with the OS) could be picked up.

* Tweaked setup.py so that it picks up the version from version.txt.

Bugs fixed
----------

* Do the right thing when handling namespaced attributes.

* fix bug where tostring() moved nodes into new documents. tostring()
  had very nasty side-effects before this fix, sorry!

0.5.1 (2005-04-09)
==================

* Python 2.2 compatibility fixes.

* unicode fixes in Element() and Comment() as well as XML(); unicode
  input wasn't properly being UTF-8 encoded.

0.5 (2005-04-08)
================

Initial public release.
