From 7bc4a59528ab13f3062dc1520e76f9ecedd87400 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Sat, 14 May 2005 15:23:23 +0000 Subject: - work on timers - add eInput widget - add python/Tools - add flexible listbox content --- lib/python/Tools/XMLTools.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 lib/python/Tools/XMLTools.py (limited to 'lib/python/Tools/XMLTools.py') diff --git a/lib/python/Tools/XMLTools.py b/lib/python/Tools/XMLTools.py new file mode 100644 index 00000000..aaab4677 --- /dev/null +++ b/lib/python/Tools/XMLTools.py @@ -0,0 +1,17 @@ +import xml.dom.minidom + +def elementsWithTag(el, tag): + + """filters all elements of childNode with the specified function + example: nodes = elementsWithTag(childNodes, lambda x: x == "bla")""" + + # fiiixme! (works but isn't nice) + if isinstance(tag, str): + s = tag + tag = lambda x: x == s + + for x in el: + if x.nodeType != xml.dom.minidom.Element.nodeType: + continue + if tag(x.tagName): + yield x -- cgit v1.2.3