summaryrefslogtreecommitdiff
path: root/python/libxml.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/libxml.py')
-rw-r--r--python/libxml.py30
1 files changed, 27 insertions, 3 deletions
diff --git a/python/libxml.py b/python/libxml.py
index 997e15f..4c9fe92 100644
--- a/python/libxml.py
+++ b/python/libxml.py
@@ -232,6 +232,23 @@ class xmlCore:
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):
@@ -535,10 +552,17 @@ def nodeWrap(o):
return xmlNode(_obj=o)
def xpathObjectRet(o):
- if type(o) == type([]) or type(o) == type(()):
- ret = map(lambda x: nodeWrap(x), o)
+ otype = type(o)
+ if otype == type([]):
+ ret = map(xpathObjectRet, o)
return ret
- return o
+ elif otype == type(()):
+ ret = map(xpathObjectRet, o)
+ return tuple(ret)
+ elif otype == type('') or otype == type(0) or otype == type(0.0):
+ return o
+ else:
+ return nodeWrap(o)
#
# register an XPath function