summaryrefslogtreecommitdiff
path: root/python/libxml.py
diff options
context:
space:
mode:
authorMike Hommey <glandium@debian.org>2006-10-26 11:17:37 +0200
committerMike Hommey <glandium@debian.org>2006-10-26 11:17:37 +0200
commit968041a8b2ec86c39b5074024ce97d136ecd9a95 (patch)
tree6971d7bce63213fd376b0e66311d0c67a8da4d64 /python/libxml.py
parenta7e9d3f37d5e9fba4b9acaa43e7c12b6d9a669ae (diff)
downloadlibxml2-968041a8b2ec86c39b5074024ce97d136ecd9a95.tar.gz
Load /tmp/libxml2-2.6.27 intoupstream/2.6.27.dfsg
libxml2/branches/upstream/current.
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