The libxml2dom package provides a traditional DOM wrapper around the Python bindings for libxml2. In contrast to the standard libxml2 bindings, libxml2dom provides an API reminiscent of minidom, pxdom and other Python-based and Python-related XML toolkits. Performance is fairly respectable since libxml2dom makes direct use of libxml2mod - the low-level wrapping of libxml2 for Python. Moreover, serialisation of documents is much faster than many other toolkits because libxml2dom can make direct use of libxml2 rather than employing Python-level mechanisms to visit and serialise nodes.
For reasons of consistency, libxml2dom uses the same MIT-style
licence as
libxml2. See the file COPYING.txt
in the docs
directory within the source code distribution.
Given the availability of libxml2, libxml2dom only needs to reside
on the
PYTHONPATH and can be installed using the setup.py
script
provided:
python setup.py install
The following descriptions identify dependencies and describe appropriate installation issues with each dependency:
Building libxml2 from source and configuring the Python bindings can be done as follows:
cd libxml2-2.6.16
./configure --with-python=/usr/local/bin/python
make
If you are to use an installation of Python installed outside
/usr/local
then specify the "prefix" accordingly. Install
(possibly as root
) in the usual way:
make install
Previous releases of libxml2 in the 2.6 series may work, but some bugs were observed with the previously recommended 2.6.0 and these may not have been fixed until 2.6.16 or slightly earlier.
The patches
directory in the source code distribution
contains a patch against libxml2 2.5.7 which resolves an issue exposed
by
libxml2dom. Although it is recommended that later releases of libxml2
are
used instead, the source code distribution of libxml2 2.5.7 can be
patched as
follows:
patch -p0 < libxml2dom/patches/libxml2/libxml.c.diff
The command should be run outside/above the libxml2-2.5.7
directory, and the stated path should be adjusted accordingly.
Python releases from 2.2 onwards should be compatible with libxml2dom. The principal requirement from such releases is the new-style class support which permits the use of properties in the libxml2dom implementation, thus simplifying the code somewhat.