diff src/tools/xml_tools.py @ 1740:681fe91abcc0

memory (params): parameter jids_list values are specified with <jid>...</jid>
author souliane <souliane@mailoo.org>
date Tue, 15 Dec 2015 14:12:19 +0100
parents ad5da569ecf4
children 6fd0881fe1fc
line wrap: on
line diff
--- a/src/tools/xml_tools.py	Tue Dec 15 13:33:35 2015 +0100
+++ b/src/tools/xml_tools.py	Tue Dec 15 14:12:19 2015 +0100
@@ -1367,6 +1367,7 @@
 def decapsulateDomishContent(elt):
     """Return the inner content of a domish.Element.
 
+    @param elt (domish.Element)
     @return unicode
     """
     result = ''
@@ -1376,3 +1377,17 @@
         except AttributeError:
             result += child  # child is unicode
     return result
+
+
+# FIXME: this method is duplicated from frontends.tools.xmlui.getText
+def getText(node):
+    """Get child text nodes of a domish.Element.
+
+    @param node (domish.Element)
+    @return: joined unicode text of all nodes
+    """
+    data = []
+    for child in node.childNodes:
+        if child.nodeType == child.TEXT_NODE:
+            data.append(child.wholeText)
+    return u"".join(data)