Re: [xml] Does libxml2 create nodes on-the-fly?
- From: Andreas Pakulat <apaku gmx de>
- To: xml gnome org
- Subject: Re: [xml] Does libxml2 create nodes on-the-fly?
- Date: Mon, 26 Jun 2006 12:26:04 +0200
On 26.06.06 05:17:37, Daniel Veillard wrote:
On Mon, Jun 26, 2006 at 10:39:05AM +0200, Andreas Pakulat wrote:
On 24.06.06 09:12:47, Daniel Veillard wrote:
On Sat, Jun 24, 2006 at 12:26:47AM +0200, Andreas Pakulat wrote:
(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 :-)
Hmm, this thread looks interesting now :-)
Thanks to William Brack I could create a proper patch that enables
comparison of Python objects derived from xmlCore (i.e. xmlNode and all
subclasses). The bugreport is 345779 and I hope it'll make it into some
not-so-distant future version of libxml2.
See it wasn't that hard :-)
Yeah, but for the most part it was copy'n'paste anyway...
William will probably commit it later if he thinks it's ready for final
inclusion,
Then I'd better change the test-patch to include 2 more tests now..
thanks, I hope doing those extra steps will help you use libxml2 in the
long term !
Well, I think this change introduced another "problem", now I can't use
the objects as index into a python dictionary. I guess this is because I
only defined the __eq__ and __ne__ operators, but the hashing probably
needs something like greater than or less than... I'll look into that
later.
Andreas
--
A vivid and creative mind characterizes you.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]