[XML-SIG] node identity with libxml2

Matt Patterson list-matt at reprocessed.org
Thu Jan 29 08:13:13 EST 2004

On 29 Jan 2004, at 12:27, M.-A. Lemburg wrote:

> Daniel Veillard wrote:
>> right, the underlying C object are the same but new wrappers are build
>> on the fly. The equality should be defined by testing the C objects 
>> pointers,
>> I don't know how to do this,
> If you implement the wrappers in Python and have access to the
> underlying C object pointers, you can implement this by overriding:
> def __cmp__(self, other):
>     if isinstance(other, self.__class__):
>         return cmp(self._cobject, other._cobject)
>     else:
>         raise TypeError

Is this something I can do in my code, or does libxml's wrapper need to 
be patched?

I tried adding

def __cmp__(self, other):
     if isinstance(other, self.__class__):
         return cmp(self._o, other. _o)
         raise TypeError

into class xmlCore, but that didn't seem to alter anything.

Should I stop fiddling and switch to PyXML for the time being?



More information about the XML-SIG mailing list