Package tdi :: Module interfaces :: Class ListenerInterface
[frames] | no frames]

Class ListenerInterface

source code

object --+
         |
        ListenerInterface
Known Subclasses:

Interface for a parser/lexer event listener.
Instance Methods
 
handle_text(self, data)
Handle text data
source code
 
handle_escape(self, escaped, data)
Handle escaped data
source code
 
handle_starttag(self, name, attrs, closed, data)
Handle start tag (<foo ....>)
source code
 
handle_endtag(self, name, data)
Handle end tag (</foo>)
source code
 
handle_comment(self, data)
Handle comment (<!-- ... -->)
source code
 
handle_msection(self, name, value, data)
Handle marked section (<![name[...]]> or <![name ...]>)
source code
 
handle_decl(self, name, value, data)
Handle declaration (<!...>)
source code
 
handle_pi(self, data)
Handle Processing instruction (<? ... ?>)
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

handle_text(self, data)

source code 
Handle text data
Parameters:
  • data (str) - The text data to handle

handle_escape(self, escaped, data)

source code 
Handle escaped data
Parameters:
  • escaped (str) - The escaped string (unescaped, despite the name)
  • data (str) - The full escape sequence

handle_starttag(self, name, attrs, closed, data)

source code 
Handle start tag (<foo ....>)
Parameters:
  • name (str) - The element name ('' for empty tag)
  • attrs (list) - The attributes ([(name, value), ...]), where value may be None for short attributes.
  • closed (bool) - Is the start tag closed? In that case, no endtag will be needed.
  • data (str) - The raw tag string

handle_endtag(self, name, data)

source code 
Handle end tag (</foo>)
Parameters:
  • name (str) - The element name ('' for empty tag)
  • data (str) - The raw tag string

handle_comment(self, data)

source code 
Handle comment (<!-- ... -->)
Parameters:
  • data (str) - The comment block

handle_msection(self, name, value, data)

source code 

Handle marked section (<![name[...]]> or <![name ...]>)

The <![name ... ]> sections are MS specific. markupbase comments:

# An analysis of the MS-Word extensions is available at
# http://www.planetpublish.com/xmlarena/xap/Thursday/WordtoXML.pdf
Parameters:
  • name (str) - The section name
  • value (str) - The section value
  • data (str) - The section block

handle_decl(self, name, value, data)

source code 
Handle declaration (<!...>)
Parameters:
  • name (str) - The name of the declaration block
  • value (str) - The value of the declaration block
  • data (str) - The declaration block

handle_pi(self, data)

source code 
Handle Processing instruction (<? ... ?>)
Parameters:
  • data (str) - The PI block