Module HTMLParser :: Class HTMLParser
[hide private]
[frames] | no frames]

_ClassType HTMLParser

markupbase.ParserBase --+
                        |
                       HTMLParser

Find tags and other markup and call handler functions.

Usage:
    p = HTMLParser()
    p.feed(data)
    ...
    p.close()

Start tags are handled by calling self.handle_starttag() or
self.handle_startendtag(); end tags by self.handle_endtag().  The
data between tags is passed from the parser to the derived class
by calling self.handle_data() with the data as argument (the data
may be split up in arbitrary chunks).  Entity references are
passed by calling self.handle_entityref() with the entity
reference as the argument.  Numeric character references are
passed to self.handle_charref() with the string containing the
reference as the argument.

Instance Methods [hide private]
 
__init__(self)
Initialize and reset this instance.
 
reset(self)
Reset this instance.
 
feed(self, data)
Feed data to the parser.
 
close(self)
Handle any buffered data.
 
error(self, message)
 
get_starttag_text(self)
Return full source of start tag: '<...>'.
 
set_cdata_mode(self)
 
clear_cdata_mode(self)
 
goahead(self, end)
 
parse_pi(self, i)
 
parse_starttag(self, i)
 
check_for_whole_start_tag(self, i)
 
parse_endtag(self, i)
 
handle_startendtag(self, tag, attrs)
 
handle_starttag(self, tag, attrs)
 
handle_endtag(self, tag)
 
handle_charref(self, name)
 
handle_entityref(self, name)
 
handle_data(self, data)
 
handle_comment(self, data)
 
handle_decl(self, decl)
 
handle_pi(self, data)
 
unknown_decl(self, data)
 
unescape(self, s)

Inherited from markupbase.ParserBase: getpos, parse_comment, parse_declaration, parse_marked_section, updatepos

Class Variables [hide private]
  CDATA_CONTENT_ELEMENTS = ('script', 'style')
  __starttag_text = None

Inherited from markupbase.ParserBase (private): _decl_otherchars

Method Details [hide private]

__init__(self)
(Constructor)

 

Initialize and reset this instance.

Overrides: markupbase.ParserBase.__init__

reset(self)

 

Reset this instance. Loses all unprocessed data.

Overrides: markupbase.ParserBase.reset

feed(self, data)

 
Feed data to the parser.

        Call this as often as you want, with as little or as much text
        as you want (may include '
').
        

error(self, message)

 
Overrides: markupbase.ParserBase.error

unknown_decl(self, data)

 
Overrides: markupbase.ParserBase.unknown_decl