Closed GoogleCodeExporter closed 8 years ago
The problem is that SimpleXMLElement only looks in the document element for
namespaces; it can be in the element itself, or any ancestor element. Here is a
simple patch that fixes the issue for me.
--- a/pysimplesoap/simplexml.py
+++ b/pysimplesoap/simplexml.py
@@ -179,8 +179,14 @@ class SimpleXMLElement(object):
def get_namespace_uri(self, ns):
"Return the namespace uri for a prefix"
- v = self.__document.documentElement.attributes['xmlns:%s' % ns]
- return v.value
+ element = self._element
+ while element is not None:
+ try:
+ return element.attributes['xmlns:%s' % ns].value
+ except KeyError:
+ element = element.parentNode
+ assert element is not None
+ assert False, "Failed to find namespace '%s'!" % ns
def attributes(self):
"Return a dict of attributes for this tag"
Original comment by misc%hl....@gtempaccount.com
on 5 Jan 2011 at 4:15
This issue was closed by revision 25757649fb06.
Original comment by reingart@gmail.com
on 23 Nov 2011 at 7:04
Fixed in 25757649fb06
Original comment by reingart@gmail.com
on 23 Nov 2011 at 7:04
Original issue reported on code.google.com by
misc%hl....@gtempaccount.com
on 5 Jan 2011 at 3:47