def __handleParagraph(self, xmlParagraph, paragraph): #p = Paragraph() p = paragraph p.idx = xmlParagraph.attributes['ID'].nodeValue if xmlParagraph.hasChildNodes(): for xmlNode in xmlParagraph.childNodes: if xmlNode.nodeName == 'S': s = Sentence() print 'before handle_sentence' self.__handleSentence( xmlNode, s ) print 'after handle_sentence' p.addSentence(s) s.paragraph = p print p, p.sentences