Module bphtml :: Class TreeParser
[hide private]
[frames] | no frames]

Class TreeParser

source code

markupbase.ParserBase --+    
                        |    
    HTMLParser.HTMLParser --+
                            |
                           TreeParser

Turns the HTML data into a tree structure

Note that the HTML needs to be well formed (ie closing tags must be present)

Nested Classes [hide private]
  TreeNode
Instance Methods [hide private]
 
__init__(self, data)
Initialize and reset this instance.
source code
 
handle_starttag(self, tag, attrs) source code
 
handle_endtag(self, tag) source code
 
handle_entityref(self, name) source code
 
handle_data(self, data) source code
 
printtree(self, node=None, indent=0) source code
 
flatten(self) source code
 
_flatten(self, node, io) source code

Inherited from HTMLParser.HTMLParser: check_for_whole_start_tag, clear_cdata_mode, close, error, feed, get_starttag_text, goahead, handle_charref, handle_comment, handle_decl, handle_pi, handle_startendtag, parse_endtag, 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]
  _nltags = ('p', 'head', 'title', 'h1', 'h2', 'h3', 'h4', 'h5',...

Inherited from HTMLParser.HTMLParser: CDATA_CONTENT_ELEMENTS

Inherited from markupbase.ParserBase (private): _decl_otherchars

Method Details [hide private]

__init__(self, data)
(Constructor)

source code 

Initialize and reset this instance.

Overrides: markupbase.ParserBase.__init__

handle_starttag(self, tag, attrs)

source code 
Overrides: HTMLParser.HTMLParser.handle_starttag

handle_endtag(self, tag)

source code 
Overrides: HTMLParser.HTMLParser.handle_endtag

handle_entityref(self, name)

source code 
Overrides: HTMLParser.HTMLParser.handle_entityref

handle_data(self, data)

source code 
Overrides: HTMLParser.HTMLParser.handle_data

Class Variable Details [hide private]

_nltags

Value:
('p', 'head', 'title', 'h1', 'h2', 'h3', 'h4', 'h5', 'table', 'tr')