summaryrefslogtreecommitdiff
path: root/python/libxml.py
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2005-04-12 01:02:29 +0000
committerDaniel Veillard <veillard@src.gnome.org>2005-04-12 01:02:29 +0000
commitf9cf6f5a01527406ed0bcbcf5a180d85b5e771de (patch)
tree5769339469c55feb02e674e6e13457bed9bffe34 /python/libxml.py
parentd49370e9c5eaf481d1bd49eaab711e743af8de54 (diff)
downloadlibxml2-f9cf6f5a01527406ed0bcbcf5a180d85b5e771de.tar.gz
applied patch from Brent Hendricks adding namespace removal at the python
* python/libxml.c python/libxml.py: applied patch from Brent Hendricks adding namespace removal at the python level #300209 * python/tests/Makefile.am python/tests/nsdel.py: added the regression test Daniel
Diffstat (limited to 'python/libxml.py')
-rw-r--r--python/libxml.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/python/libxml.py b/python/libxml.py
index 2eca71e8..86bdd92d 100644
--- a/python/libxml.py
+++ b/python/libxml.py
@@ -429,6 +429,27 @@ class xmlCore:
def xpathEval2(self, expr):
return self.xpathEval(expr)
+ # Remove namespaces
+ def removeNsDef(self, href):
+ """
+ Remove a namespace definition from a node. If href is None,
+ remove all of the ns definitions on that node. The removed
+ namespaces are returned as a linked list.
+
+ Note: If any child nodes referred to the removed namespaces,
+ they will be left with dangling links. You should call
+ renciliateNs() to fix those pointers.
+
+ Note: This method does not free memory taken by the ns
+ definitions. You will need to free it manually with the
+ freeNsList() method on the returns xmlNs object.
+ """
+
+ ret = libxml2mod.xmlNodeRemoveNsDef(self._o, href)
+ if ret is None:return None
+ __tmp = xmlNs(_obj=ret)
+ return __tmp
+
# support for python2 iterators
def walk_depth_first(self):
return xmlCoreDepthFirstItertor(self)