#NEWLINE# def getTextFromNode( node ) : #NEWLINE# #INDENT# '\n    scans through all children of node and gathers the\n    text. if node has non-text child-nodes, then\n    NotTextNodeError is raised.\n    ' #NEWLINE# t = '' #NEWLINE# for n in node . childNodes : #NEWLINE# #INDENT# if ( n . nodeType == n . TEXT_NODE ) : #NEWLINE# #INDENT# t += n . nodeValue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise NotTextNodeError #NEWLINE# #UNINDENT# #UNINDENT# return t