Re: [xml] Does libxml2 create nodes on-the-fly?

On 23.06.06 17:05:08, Daniel Veillard wrote:
On Fri, Jun 23, 2006 at 10:07:20PM +0200, Andreas Pakulat wrote:
On 20.06.06 20:00:37, Andreas Pakulat wrote:
On 20.06.06 18:25:05, Buchcik, Kasimier wrote:
It seems that I always get new python objects everytime I ask for
node.children, is that correct? This makes it rather hard to 

Yes, this is the intended behaviour; otherwise one would have to
implement reference counting or keep the python wrapper objects
for Libxml's nodes always alive.

DOM Level 3 introduced the method "isSameNode" for such scenarios:

Well, nice to know there is a way in theory, but how about libxml2's
actual set of functions? I couldn't find anything with the libxml2
module. So does libxml2 (the python bindings) provide any means of
checking wether 2 nodes are the same wrt. to the dom? 

Anybody with a hint, how to check wether 2 nodes are the same?

  unfortunately I'm afraid you need to go down to the C level and
check the 2 pointers, they aren't seen at the python level. Should be
a fairly easy change to python/libxml.c to add this equality entry point
and then add a method in the node class in to be used for

Ok, first I'll open a wishlist bug for this and then I'll try to do this
(though I'm not familiar with libxml2's C Interface, nor the
Python-C-Bridge-Stuff in general)...


The whole world is a tuxedo and you are a pair of brown shoes.
                -- George Gobel

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