Re: [xml] Support for Python
- From: Daniel Veillard <veillard redhat com>
- To: Dave Kuhlman <dkuhlman cutter rexx com>
- Cc: xml gnome org
- Subject: Re: [xml] Support for Python
- Date: Tue, 29 Jan 2002 03:10:55 -0500
On Mon, Jan 28, 2002 at 02:51:20PM -0800, Dave Kuhlman wrote:
And doesn't seem to produce a .py . It produce pydom_wrap.c, which then
compiles and load but I'm unable to load anything :
I think the trick is to add the flag "-shadow" when you run swig.
Here is the command line that I use:
swig -python -shadow -I/w2/XML/Libxml/libxml2-2.4.13/include/libxml pydom.i
The same here except for the include path
And here is my pydom.i:
Mine is based on yours, very close.
import pydom
doc = pydom.xmlParseFile("test1.xml")
print 'version: %s' % pydom.x2c(doc.version)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: version
OK. I don't understand this either. I'm using Python 2.2, but I do
not believe there is anything in it that requires version 2.2.
I tried it with Python 2.1 (after rebuilding the .so with Python
2.1 include files). My tree walk test runs OK.
What version of SWIG ? I have swig-1.3a5 installed. Older versions
had a lot of troubles parsing the include files.
tried version_get which from my reading of the C code should work,
but it fails too ... weird. I have tried with both 1.5 and 2.1 without
success.
SWIG does some "name mangling" (at least when I generate shadow
classes) to keep methods in separate classes unique. For the
xmlDoc, in my generated code, I believe the function is called
xmlDoc_version_get.
yep seen that but for me it generates a version_get and version_set
but I can't get access to them either.
More testing is definitely needed,
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard redhat com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]