problems with libxml2dom

A

ankit

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:

Traceback (most recent call last):
File "namespaces.py", line 23, in ?
document = libxml2dom.parse("test_ns.xml")
File "/usr/lib/python2.2/site-packages/libxml2dom/__init__.py", line
472, in parse
return parseFile(stream_or_string, html)
File "/usr/lib/python2.2/site-packages/libxml2dom/__init__.py", line
484, in parseFile
return Document(Node_parseFile(filename, html))
File
"/usr/lib/python2.2/site-packages/libxml2dom/macrolib/macrolib.py",
line 431, in parseFile
libxml2mod.xmlCtxtUseOptions(context, XML_PARSE_NOERROR |
XML_PARSE_NOWARNING | XML_PARSE_NONET)
AttributeError: 'module' object has no attribute 'xmlCtxtUseOptions'

This error comes to all that examples where libxml2dom.parse() is get
called.

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

please let me know.
 
P

Paul Boddie

ankit said:
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/macrolib.py",
line 431, in parseFile
libxml2mod.xmlCtxtUseOptions(context, XML_PARSE_NOERROR |
XML_PARSE_NOWARNING | XML_PARSE_NONET)
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.

Paul

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top