#NEWLINE# def element_text( elem ) : #NEWLINE# #INDENT# if ( elem . nodeType == elem . TEXT_NODE ) : #NEWLINE# #INDENT# return elem . nodeValue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# s = '' #NEWLINE# for child in elem . childNodes : #NEWLINE# #INDENT# s += element_text ( s ) #NEWLINE# #UNINDENT# return s