#NEWLINE# def parse_starttag( self , i ) : #NEWLINE# #INDENT# self . __starttag_text = None #NEWLINE# endpos = self . check_for_whole_start_tag ( i ) #NEWLINE# if ( endpos < 0 ) : #NEWLINE# #INDENT# return endpos #NEWLINE# #UNINDENT# rawdata = self . rawdata #NEWLINE# self . __starttag_text = rawdata [ i : endpos ] #NEWLINE# attrs = [ ] #NEWLINE# match = tagfind . match ( rawdata , ( i + 1 ) ) #NEWLINE# assert match , 'unexpected call to parse_starttag()' #NEWLINE# k = match . end ( ) #NEWLINE# self . lasttag = tag = match . group ( 1 ) . lower ( ) #NEWLINE# while ( k < endpos ) : #NEWLINE# #INDENT# m = _html_parser . attrfind . match ( rawdata , k ) #NEWLINE# if ( not m ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# ( attrname , rest , attrvalue ) = m . group ( 1 , 2 , 3 ) #NEWLINE# if ( not rest ) : #NEWLINE# #INDENT# attrvalue = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( attrvalue [ : 1 ] == "'" == attrvalue [ ( - 1 ) : ] ) or ( attrvalue [ : 1 ] == '"' == attrvalue [ ( - 1 ) : ] ) ) : #NEWLINE# #INDENT# attrvalue = attrvalue [ 1 : ( - 1 ) ] #NEWLINE# #UNINDENT# #UNINDENT# if attrvalue : #NEWLINE# #INDENT# attrvalue = self . unescape ( attrvalue ) #NEWLINE# #UNINDENT# attrs . append ( ( attrname . lower ( ) , attrvalue ) ) #NEWLINE# k = m . end ( ) #NEWLINE# #UNINDENT# end = rawdata [ k : endpos ] . strip ( ) #NEWLINE# if ( end not in ( '>' , '/>' ) ) : #NEWLINE# #INDENT# ( lineno , offset ) = self . getpos ( ) #NEWLINE# if ( '\n' in self . __starttag_text ) : #NEWLINE# #INDENT# lineno = ( lineno + self . __starttag_text . count ( '\n' ) ) #NEWLINE# offset = ( len ( self . __starttag_text ) - self . __starttag_text . rfind ( '\n' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# offset = ( offset + len ( self . __starttag_text ) ) #NEWLINE# #UNINDENT# self . error ( ( 'junk characters in start tag: %r' % ( rawdata [ k : endpos ] [ : 20 ] , ) ) ) #NEWLINE# #UNINDENT# if end . endswith ( '/>' ) : #NEWLINE# #INDENT# self . handle_startendtag ( tag , attrs ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . handle_starttag ( tag , attrs ) #NEWLINE# if ( tag in self . CDATA_CONTENT_ELEMENTS ) : #NEWLINE# #INDENT# self . set_cdata_mode ( tag ) #NEWLINE# #UNINDENT# #UNINDENT# return endpos