Package openid :: Package yadis :: Module parsehtml :: Class YadisHTMLParser
[hide private]
[frames] | no frames]

Class YadisHTMLParser

source code

markupbase.ParserBase --+    
                        |    
    HTMLParser.HTMLParser --+
                            |
                           YadisHTMLParser

Parser that finds a meta http-equiv tag in the head of a html document.

When feeding in data, if the tag is matched or it will never be found, the parser will raise ParseDone with the uri as the first attribute.

Parsing state diagram

Any unlisted input does not affect the state:

           1, 2, 5                       8
          +--------------------------+  +-+
          |                          |  | |
       4  |    3       1, 2, 5, 7    v  | v
   TOP -> HTML -> HEAD ----------> TERMINATED
   | |            ^  |               ^  ^
   | | 3          |  |               |  |
   | +------------+  +-> FOUND ------+  |
   |                  6         8       |
   | 1, 2                               |
   +------------------------------------+

 1. any of </body>, </html>, </head> -> TERMINATE
 2. <body> -> TERMINATE
 3. <head> -> HEAD
 4. <html> -> HTML
 5. <html> -> TERMINATE
 6. <meta http-equiv='X-XRDS-Location'> -> FOUND
 7. <head> -> TERMINATE
 8. Any input -> TERMINATE
Instance Methods [hide private]
 
__init__(self)
Initialize and reset this instance.
source code
 
_terminate(self) source code
 
handle_endtag(self, tag) source code
 
handle_starttag(self, tag, attrs) source code
 
feed(self, chars)
Feed data to the parser.
source code

Inherited from HTMLParser.HTMLParser: check_for_whole_start_tag, clear_cdata_mode, close, error, get_starttag_text, goahead, handle_charref, handle_comment, handle_data, handle_decl, handle_entityref, handle_pi, handle_startendtag, parse_bogus_comment, parse_endtag, parse_html_declaration, parse_pi, parse_starttag, reset, set_cdata_mode, unescape, unknown_decl

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

Inherited from markupbase.ParserBase (private): _parse_doctype_attlist, _parse_doctype_element, _parse_doctype_entity, _parse_doctype_notation, _parse_doctype_subset, _scan_name

Class Variables [hide private]
  TOP = 0
  HTML = 1
  HEAD = 2
  FOUND = 3
  TERMINATED = 4

Inherited from HTMLParser.HTMLParser: CDATA_CONTENT_ELEMENTS, entitydefs

Inherited from markupbase.ParserBase (private): _decl_otherchars

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Initialize and reset this instance.

Overrides: markupbase.ParserBase.__init__

handle_endtag(self, tag)

source code 
Overrides: HTMLParser.HTMLParser.handle_endtag

handle_starttag(self, tag, attrs)

source code 
Overrides: HTMLParser.HTMLParser.handle_starttag

feed(self, chars)

source code 

Feed data to the parser.

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

Overrides: HTMLParser.HTMLParser.feed
(inherited documentation)