Lines Matching refs:HTMLParser
15 This module defines a class :class:`HTMLParser` which serves as the basis for
18 .. class:: HTMLParser(*, convert_charrefs=True)
26 An :class:`.HTMLParser` instance is fed HTML data and calls handler methods
28 encountered. The user should subclass :class:`.HTMLParser` and override its
45 :class:`HTMLParser` class to print out start tags, end tags, and data
48 from html.parser import HTMLParser
50 class MyHTMLParser(HTMLParser):
82 :class:`.HTMLParser` Methods
85 :class:`HTMLParser` instances have the following methods:
88 .. method:: HTMLParser.feed(data)
95 .. method:: HTMLParser.close()
100 the :class:`HTMLParser` base class method :meth:`close`.
103 .. method:: HTMLParser.reset()
109 .. method:: HTMLParser.getpos()
114 .. method:: HTMLParser.get_starttag_text()
124 implementations do nothing (except for :meth:`~HTMLParser.handle_startendtag`):
127 .. method:: HTMLParser.handle_starttag(tag, attrs)
144 .. method:: HTMLParser.handle_endtag(tag)
151 .. method:: HTMLParser.handle_startendtag(tag, attrs)
159 .. method:: HTMLParser.handle_data(data)
165 .. method:: HTMLParser.handle_entityref(name)
173 .. method:: HTMLParser.handle_charref(name)
182 .. method:: HTMLParser.handle_comment(data)
194 .. method:: HTMLParser.handle_decl(decl)
203 .. method:: HTMLParser.handle_pi(data)
213 The :class:`HTMLParser` class uses the SGML syntactic rules for processing
218 .. method:: HTMLParser.unknown_decl(data)
235 from html.parser import HTMLParser
238 class MyHTMLParser(HTMLParser):
318 Feeding incomplete chunks to :meth:`~HTMLParser.feed` works, but
319 :meth:`~HTMLParser.handle_data` might be called more than once