Re: [xml] Does libxml2 create nodes on-the-fly?
- From: Daniel Veillard <veillard redhat com>
- To: xml gnome org
- Subject: Re: [xml] Does libxml2 create nodes on-the-fly?
- Date: Sat, 24 Jun 2006 09:12:47 -0400
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 libxml.py to be used for
comparison.
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 libxml.py override the comparator operator to call that routine
in libxml2mod, add a python test case in test/ and bingo you're done :-)
Daniel
--
Daniel Veillard | Red Hat http://redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]