problems with libxml2dom

Paul Boddie paul at
Wed Jan 4 18:36:16 EST 2006

ankit wrote:
> Hi,
> I am working with libxml2dom package for having DOM support with
> libxml2.
> There are some test examples are given along with the package  but when
> I try to run that, it gives me following error:


>   File
> "/usr/lib/python2.2/site-packages/libxml2dom/macrolib/",
> line 431, in parseFile
>     libxml2mod.xmlCtxtUseOptions(context, XML_PARSE_NOERROR |
> AttributeError: 'module' object has no attribute 'xmlCtxtUseOptions'
> This error comes to all that examples where libxml2dom.parse() is get
> called.

Sorry to leave you hanging around for an answer! Anyway, it would be
interesting to know which version of libxml2 (and its Python bindings)
you're using. Unfortunately, I can't find an easy way of doing this
within Python (ie. libxml2mod.__version__, libxml2.__version__ or
something like that), but inspecting your package manager's records
should provide an answer; for example:

$ dpkg -l python2.4-libxml2


ii  python2.4-libxml2  2.6.17-0ubuntu1  Python 2.4 bindings for the
GNOME XML library

> Is there something wrong with the package OR I am wrong somewhere .

There could be something wrong with the package - I should make the
tests more relevant to what the package actually does these days - but
I'm guessing that you're using an older version of the libxml2 Python
bindings. It could well be that the missing function isn't exposed by
earlier versions of the bindings, and yet I've come to rely on that
function in order to preserve some reasonable behaviour when parsing
documents. The software probably doesn't need a totally up-to-date
version of Python, but my experience has been that the more recent a
version of libxml2 you can get, the better everything generally is.


P.S. Feel free to e-mail me with any problems: my address should be in
various places in the libxml2dom distribution.

More information about the Python-list mailing list