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

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


Daniel Veillard      | Red Hat
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]