Re: libxml-python C-API question
[email protected] Thu, 6 Jun 2002 13:11:02 +0200
| Newsgroups | gmane.comp.gnome.lib.xml.bindings |
|---|---|
| Message-ID | <20020606111102.GB15072@www> |
On Thu, Jun 06, 2002 at 06:18:49AM -0400, Daniel Veillard wrote:
> hum, at the python level you *must* call that function with the
> _o field of the xmlCore (or descendant classe) instance.
> Could you check first you did that at the python level, check
> libxml2.py to see how it's done usually.
Ah, thanks a lot! So changing
parseString(node, "A test") to parseString(node._o, "A test")
does it. So it works, but it looks ugly. If i read your code right
that seems to be the reason for your wrappers in libxml2.py. Is there
no way to do the unwrapping on the C side?
>
> err, I'm not sure I understand. You mean calling from C code the
> python wrappers ? I have a hard time figuring out why one would want
> to do this ...
No, more like this: assume a module that provides functions that want
to return XML data (as a silly example: mod_weather.py with a function
weatherAsXml('New Haven') ). It would be very convenient if the function
could return an libxl2 document object so that the return value could
be processed with functions from libxml2/libxslt. I consider this as
an essential functionallity for the interplay of modules creating or
modifying XML data. BTW, i'm _not_ really a Python programmer so maybe
i miss something rather obvious. I just had a look at
http://www.python.org/doc/current/ext/using-cobjects.html and wondered
whether an API as difined in this doc is planned for libxml2.
Thanks again
Ralf Mattes