def parse(self):
        while self.pos < len(self.text):
            if self.match('<'): #tag process
                if self.match('</'):
                    if not self.parse_end_tag():
                        break
                elif self.match('<![CDATA['):
                    end_pos = self.text.find(']]>', self.pos+9)
                    if end_pos != -1:
                        self.top['_text'] += self.decode(self.text[self.pos+9:end_pos].strip())
                        self.pos = end_pos + 3
                    else:
                        raise ParseError("<![CDATA[ is not completed!")
                elif self.match('<![['):
                    end_pos = self.text.find(']]>', self.pos+4)
                    if end_pos != -1:
                        self.top['_text'] += self.decode(self.text[self.pos+4:end_pos].strip())
                        self.pos = end_pos + 3
                    else:
                        raise ParseError("<![[ is not completed!")
                elif self.match('<!--'):
                    end_pos = self.text.find('-->', self.pos+4)
                    if end_pos != -1:
                        self.pos = end_pos + 3
                    else:
                        raise ParseError("Comment is not completed!")
                else:
                    self.parse_begin_tag()
            else:
                b = self.feed(self.r_text)
                if b and self.stack:
                    self.top['_text'] += self.decode(b.group().strip())
dataset/ETHPy150Open limodou/uliweb/uliweb/core/taglibs.py/ParseXML.parse/original