473,791 Members | 3,229 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problems with libxml2dom

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.pars e("test_ns.xml" )
File "/usr/lib/python2.2/site-packages/libxml2dom/__init__.py", line
472, in parse
return parseFile(strea m_or_string, html)
File "/usr/lib/python2.2/site-packages/libxml2dom/__init__.py", line
484, in parseFile
return Document(Node_p arseFile(filena me, html))
File
"/usr/lib/python2.2/site-packages/libxml2dom/macrolib/macrolib.py",
line 431, in parseFile
libxml2mod.xmlC txtUseOptions(c ontext, XML_PARSE_NOERR OR |
XML_PARSE_NOWAR NING | XML_PARSE_NONET )
AttributeError: 'module' object has no attribute 'xmlCtxtUseOpti ons'

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

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

please let me know.

Dec 27 '05 #1
1 1915
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/macrolib.py",
line 431, in parseFile
libxml2mod.xmlC txtUseOptions(c ontext, XML_PARSE_NOERR OR |
XML_PARSE_NOWAR NING | XML_PARSE_NONET )
AttributeError: 'module' object has no attribute 'xmlCtxtUseOpti ons'

This error comes to all that examples where libxml2dom.pars e() 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.__ve rsion__, libxml2.__versi on__ 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.

Jan 4 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1070
by: ankit | last post by:
Hi I am using libxml2dom package for DOM support in libxml2. There are some test programs in the package when I try to run that samples it give me following error: Traceback (most recent call last): File "prettyprint.py", line 7, in ? d = libxml2dom.parse(sys.argv) File "/usr/lib/python2.2/site-packages/libxml2dom/__init__.py", line 472, in parse
2
1601
by: ankit | last post by:
I am using libxml2dom but having problem when parsing. It gives me the following error: File "exlibxml2dom.py", line 4, in ? document = libxml2dom.parse("moc.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
4
3369
by: ankit | last post by:
I had installed libxml2 for python (libxml2-python-2.6.22.win32-py2.4) on WINDOWS. For having dom support I am installing libxml2dom (0.3). My python version on win is 2.4 but when I give run the install as: python setup.py install I get following error: ----
0
382
by: bruce | last post by:
hi paul... in playing around with the test python app (see below) i've got a couple of basic questions. i can't seem to find the answers via google, and when i've looked in the libxml2dom stuff that i downloaded i didn't see answers either... for the list in the "for label in d.xpath" how can i find out the size of the list???? a simple/basic question, but it's driving me up a wall!!!
2
4976
by: =?iso-8859-1?q?KLEIN_St=E9phane?= | last post by:
Hi, I've a xml svg file and I would like to update it with Python. First, I would like to fetch one dom node with getElementByID. I've one issue about this method. This is my example : My SVG file :
2
1676
by: bruce | last post by:
Hi... I'm using quick test with libxml2dom =============== import libxml2dom aa=libxml2dom.parseString(foo) ff=libxml2dom.toString(aa)
1
1942
by: bruce | last post by:
hi... i've got the following situation, with the following test url: "http://schedule.psu.edu/soc/fall/Alloz/a-c/acctg.html#". i can generate a list of the tables i want for the courses on the page. however, when i try to create the xpath query, and plug it into the xpath within python, i'm missing something. if i have a parent xpath query, that generates a list of results/nodes... how can i then use the individual parent node, and...
0
945
by: bruce | last post by:
hi... i can use an xpath query to create a node from an html/dom representation. however, if i have a node, is there a way to generate an xpath query from the node. in testing with firefox/dom inspector, i can use "ancestor::*", but i can't determine where/how to implement this using mechanize/libxml2dom thanks
0
818
by: John J Lee | last post by:
On Mon, 1 Sep 2008, bruce wrote: Just a general point: try lxml.etree instead? Friendlier API. John
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9987
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9023
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7531
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6770
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5424
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5552
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4100
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.