[xml] How do I detect node identity in the Python bindings?



How do I get the same reference for a node in libxml2?

The Python wrappers and the PyCObject have different references, so I can't seem to find a safe way to deallocate memory.

Here's a snippet to show the problem:

 >>> import libxml2
 >>> doc = libxml2.newDoc('1.0')
 >>> root = doc.newChild(None, 'root', None)
>>> print root, doc.children <xmlNode (root) object at 0x419c60> <xmlNode (root) object at 0x4710d0>
 >>> print root._o, doc.children._o
<PyCObject object at 0x221d0> <PyCObject object at 0x22170>

Is this a bug in libxml2's Python bindings or does libxml2 exhibit this behavior when I use the native C bindings?

vic




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