BigBrotherBot v1.8.0
System Development Information for the BigBrotherBot project.

b3::lib::elementtree::HTMLTreeBuilder::HTMLTreeBuilder Class Reference

ElementTree builder for HTML source code. More...

Inheritance diagram for b3::lib::elementtree::HTMLTreeBuilder::HTMLTreeBuilder:
b3::lib::elementtree::HTMLTreeBuilder::HTMLParser

List of all members.

Public Member Functions

def __init__
def close
 Flushes parser buffers, and return the root element.
def handle_starttag
 (Internal) Handles start tags.
def handle_endtag
 (Internal) Handles end tags.
def handle_charref
 (Internal) Handles character references.
def handle_entityref
 (Internal) Handles entity references.
def handle_data
 (Internal) Handles character data.
def unknown_entityref
 (Hook) Handles unknown entity references.

Public Attributes

 encoding

Private Attributes

 __stack
 __builder

Detailed Description

ElementTree builder for HTML source code.

This builder converts an HTML document or fragment to an ElementTree.

The parser is relatively picky, and requires balanced tags for most elements. However, elements belonging to the following group are automatically closed: P, LI, TR, TH, and TD. In addition, the parser automatically inserts end tags immediately after the start tag, and ignores any end tags for the following group: IMG, HR, META, and LINK.

builder Optional builder object. If omitted, the parser uses the standard elementtree builder. encoding Optional character encoding, if known. If omitted, the parser looks for META tags inside the document. If no tags are found, the parser defaults to ISO-8859-1. Note that if your document uses a non-ASCII compatible encoding, you must decode the document before parsing.

See also:
elementtree.ElementTree

Constructor & Destructor Documentation

def b3::lib::elementtree::HTMLTreeBuilder::HTMLTreeBuilder::__init__ (   self,
  builder = None,
  encoding = None 
)

Member Function Documentation

def b3::lib::elementtree::HTMLTreeBuilder::HTMLTreeBuilder::close (   self)

Flushes parser buffers, and return the root element.

Returns:
An Element instance.
def b3::lib::elementtree::HTMLTreeBuilder::HTMLTreeBuilder::handle_charref (   self,
  char 
)

(Internal) Handles character references.

def b3::lib::elementtree::HTMLTreeBuilder::HTMLTreeBuilder::handle_data (   self,
  data 
)

(Internal) Handles character data.

def b3::lib::elementtree::HTMLTreeBuilder::HTMLTreeBuilder::handle_endtag (   self,
  tag 
)

(Internal) Handles end tags.

def b3::lib::elementtree::HTMLTreeBuilder::HTMLTreeBuilder::handle_entityref (   self,
  name 
)

(Internal) Handles entity references.

def b3::lib::elementtree::HTMLTreeBuilder::HTMLTreeBuilder::handle_starttag (   self,
  tag,
  attrs 
)

(Internal) Handles start tags.

def b3::lib::elementtree::HTMLTreeBuilder::HTMLTreeBuilder::unknown_entityref (   self,
  name 
)

(Hook) Handles unknown entity references.

The default action is to ignore unknown entities.


Member Data Documentation


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Properties