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

On Sat, Jun 24, 2006 at 12:26:47AM +0200, Andreas Pakulat wrote:
On 23.06.06 17:05:08, Daniel Veillard wrote:
On Fri, Jun 23, 2006 at 10:07:20PM +0200, Andreas Pakulat wrote:
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

  that that's a good first step :-)

(though I'm not familiar with libxml2's C Interface, nor the
Python-C-Bridge-Stuff in general)...

  Should be fairly simple, make a C python binding routine based on
existing ones in python/libxml.c , give it a significant name,
change the beginning to expect 2 python obect references as arguments,
see type.h to see how the C object is attached, get the two xmlNodePtr
associated. Compare them, and return an python 0 or 1, then register
the new routine at the end of libxml.c
  now in override the comparator operator to call that routine
in libxml2mod, add a python test case in test/ and bingo you're done :-)


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]