Re: [xml-bindings]libxml-python C-API question

On Thu, Jun 06, 2002 at 11:30:11AM +0200, rm fabula de wrote:
> Hello everyone,
> i'm trying to write a python (c-extension) module  that needs to
> modify libxml2 documents. I seem to run against a (unfortunately
> invisible :) wall when i try to get my hands on the xmlNodePtr
> from within a function that gets passed a node. Here's the
> stripped-down code:

  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 to see how it's done usually.

> Now, as you might have realized, most of the code is snarfed from the
> python bindings code (i copied libxml_wrap.h). Still, if i call the function 
> from python the node/document doesn't change. Worse: if i add a call to 
> xmlDebugDumpNode() the whole thing segfaults.
> I tried using:

  tha peoblem is likely to be that pyobj_tree is not what you expect.

>   doc   = (xmlNodePtr) PyCObject_AsVoidPtr(doc)
> which _should_ do the unwrapping, but that call returns NULL.
> Any pointers to where to start looking for my stupidity?
>  Ralf Mattes
> PS: since i would guess that libxml2-python might be often used from other
> modules, are there any plans to add a public C interface to it?
>  doc   = (xmlNodePtr) PyCObject_AsVoidPtr(doc);

  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 ...


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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