summaryrefslogtreecommitdiff
path: root/python/mllib/dom.py
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2009-08-11 15:17:18 +0000
committerRafael H. Schloming <rhs@apache.org>2009-08-11 15:17:18 +0000
commitba9a0311f80e2d65711f490534a2a3d1854637ee (patch)
treee458458fa01bdc6a5f1140ea776fe21a8a3d7349 /python/mllib/dom.py
parent920e5d38f7c4ac2b9eb06b8886d127bda2643e4d (diff)
downloadqpid-python-ba9a0311f80e2d65711f490534a2a3d1854637ee.tar.gz
added support for setting attributes
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@803150 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/mllib/dom.py')
-rw-r--r--python/mllib/dom.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/python/mllib/dom.py b/python/mllib/dom.py
index df2b88322a..486f7082e1 100644
--- a/python/mllib/dom.py
+++ b/python/mllib/dom.py
@@ -148,6 +148,21 @@ class Tag(Node):
if name == k:
return v
+ def _idx(self, attr):
+ idx = 0
+ for k, v in self.attrs:
+ if k == attr:
+ return idx
+ idx += 1
+ return None
+
+ def set_attr(self, name, value):
+ idx = self._idx(name)
+ if idx is None:
+ self.attrs.append((name, value))
+ else:
+ self.attrs[idx] = (name, value)
+
def dispatch(self, f):
try:
attr = "do_" + self.name