RE: [xml] Crashes trying XPath stuff with Python bindings



Hi,

Have you already looked at lxml? It's built on top of Libxml2/Libxslt
and
may be easier to handle on the Python side:
http://codespeak.net/lxml/

Regards,

Kasimier

-----Original Message-----
From: xml-bounces gnome org [mailto:xml-bounces gnome org] On 
Behalf Of Gary Coady
Sent: Friday, June 09, 2006 7:55 PM
To: Andreas Pakulat
Cc: xml gnome org
Subject: Re: [xml] Crashes trying XPath stuff with Python bindings

Andreas Pakulat wrote:
Hi,

I'm not sure I'm doing the right thing here, thus I'm not 
(yet) filing a
bugreport. I want to use the python bindings for libxml2 and thus
installed libxml2 (2.6.26) and libxslt (1.1.17). Now doing my first
steps results in crashes of the python interpreter:

import libxml2
doc=libxml2.parseFile('/home/andreas/temp/file1.xml')
xpath=libxml2.xpathContext(doc)
result=xpath.xpathEvalExpression('//body')

I'll have to let somebody else comment on whether that *should* work
(there's no dictionary, so I guess the code should create 
one?), and I'm
not sure if that method is supposed to be used by external users.

But you should be able to get past the problem with

import libxml2
doc = libxml2.parseFile('/home/andreas/temp/file1.xml')
xpath = doc.xpathNewContext()
result = xpath.xpathEvalExpression('//body')

Gary.
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]