Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
1739:a12e5e866d25 | 1740:681fe91abcc0 |
---|---|
1365 | 1365 |
1366 | 1366 |
1367 def decapsulateDomishContent(elt): | 1367 def decapsulateDomishContent(elt): |
1368 """Return the inner content of a domish.Element. | 1368 """Return the inner content of a domish.Element. |
1369 | 1369 |
1370 @param elt (domish.Element) | |
1370 @return unicode | 1371 @return unicode |
1371 """ | 1372 """ |
1372 result = '' | 1373 result = '' |
1373 for child in elt.children: | 1374 for child in elt.children: |
1374 try: | 1375 try: |
1375 result += child.toXml() # child id a domish.Element | 1376 result += child.toXml() # child id a domish.Element |
1376 except AttributeError: | 1377 except AttributeError: |
1377 result += child # child is unicode | 1378 result += child # child is unicode |
1378 return result | 1379 return result |
1380 | |
1381 | |
1382 # FIXME: this method is duplicated from frontends.tools.xmlui.getText | |
1383 def getText(node): | |
1384 """Get child text nodes of a domish.Element. | |
1385 | |
1386 @param node (domish.Element) | |
1387 @return: joined unicode text of all nodes | |
1388 """ | |
1389 data = [] | |
1390 for child in node.childNodes: | |
1391 if child.nodeType == child.TEXT_NODE: | |
1392 data.append(child.wholeText) | |
1393 return u"".join(data) |