def xmltoolkit62():
 ENTITIES = {u'rsquo': u'\u2019', u'lsquo': u'\u2018'}
 parser = ET.XMLTreeBuilder()
 parser.entity.update(ENTITIES)
 parser.feed(XMLTOOLKIT62_DOC)
 t = parser.close()
 return t.find('.//paragraph').text

def xmltoolkit62 ( ) : ENTITIES = { u'rsquo' : u'\u2019' , u'lsquo' : u'\u2018' } parser = ET . XMLTreeBuilder ( ) parser . entity . update ( ENTITIES ) parser . feed ( XMLTOOLKIT62_DOC ) t = parser . close ( ) return t . find ( './/paragraph' ) . text
dont crash when using custom entities .