Re: [xml-bindings]libxml-python C-API question
- From: Daniel Veillard <veillard redhat com>
- To: rm fabula de
- Cc: xml-bindings gnome org
- Subject: Re: [xml-bindings]libxml-python C-API question
- Date: Thu, 6 Jun 2002 07:31:13 -0400
On Thu, Jun 06, 2002 at 01:11:02PM +0200, rm fabula de wrote:
> 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?
Simpler to wrap at the python level, just encapsulate your call to
parseString. At least for generated stubs I found it had a lot of good
properties at the cost of IMHO minimal uglyness.
> > 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
Okay, simply get mod_weather.py to use the libxml2 python module,
I don't see why you want to go back to C ? Maybe I'm confused or the
morning coffee didn't made effect ...
> 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.
I'm still not sure I fully understand, but I definitely take patches :-)
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]