summaryrefslogtreecommitdiff
path: root/suds/sax/element.py
diff options
context:
space:
mode:
Diffstat (limited to 'suds/sax/element.py')
-rw-r--r--suds/sax/element.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/suds/sax/element.py b/suds/sax/element.py
index 2654bb6..ca44801 100644
--- a/suds/sax/element.py
+++ b/suds/sax/element.py
@@ -820,12 +820,24 @@ class Element:
@return: A flat list of nodes.
@rtype: [L{Element},..]
"""
- branch = []
+ branch = [self]
for c in self.children:
- branch.append(c)
branch += c.branch()
return branch
+ def ancestors(self):
+ """
+ Get a list of ancestors.
+ @return: A list of ancestors.
+ @rtype: [L{Element},..]
+ """
+ ancestors = []
+ p = self.parent
+ while p is not None:
+ ancestors.append(p)
+ p = p.parent
+ return ancestors
+
def walk(self, visitor):
"""
Walk the branch and call the visitor function
@@ -955,7 +967,7 @@ class PrefixNormalizer:
@rtype: set
"""
s = set()
- for n in self.branch:
+ for n in self.branch + self.node.ancestors():
if self.permit(n.expns):
s.add(n.expns)
s = s.union(self.pset(n))