Added code submitted by Andreas Pakulat to provide node equality,
* python/libxml.c, python/libxml.py, python/tests/compareNodes.py,
python/tests/Makefile.am:
Added code submitted by Andreas Pakulat to provide node
equality, inequality and hash functions, plus a single
test program to check the functions (bugs 345779 + 345961).
diff --git a/python/libxml.py b/python/libxml.py
index 997e15f..f7c3129 100644
--- a/python/libxml.py
+++ b/python/libxml.py
@@ -232,6 +232,23 @@
self._o = _obj;
return
self._o = None
+
+ def __eq__(self, other):
+ if other == None:
+ return False
+ ret = libxml2mod.compareNodesEqual(self._o, other._o)
+ if ret == None:
+ return False
+ return ret == True
+ def __ne__(self, other):
+ if other == None:
+ return True
+ ret = libxml2mod.compareNodesEqual(self._o, other._o)
+ return not ret
+ def __hash__(self):
+ ret = libxml2mod.nodeHash(self._o)
+ return ret
+
def __str__(self):
return self.serialize()
def get_parent(self):