pymilter 1.0.5
Milter.sgmllib.SGMLParser Class Reference
Inheritance diagram for Milter.sgmllib.SGMLParser:
Milter.sgmllib.TestSGMLParser

Public Member Functions

 __init__ (self, verbose=0)
 reset (self)
 setnomoretags (self)
 setliteral (self, *args)
 feed (self, data)
 close (self)
 error (self, message)
 goahead (self, end)
 parse_pi (self, i)
 get_starttag_text (self)
 parse_starttag (self, i)
 parse_endtag (self, i)
 finish_shorttag (self, tag, data)
 finish_starttag (self, tag, attrs)
 finish_endtag (self, tag)
 handle_starttag (self, tag, method, attrs)
 handle_endtag (self, tag, method)
 report_unbalanced (self, tag)
 convert_charref (self, name)
 convert_codepoint (self, codepoint)
 handle_charref (self, name)
 convert_entityref (self, name)
 handle_entityref (self, name)
 handle_data (self, data)
 handle_comment (self, data)
 handle_decl (self, decl)
 handle_pi (self, data)
 unknown_starttag (self, tag, attrs)
 unknown_endtag (self, tag)
 unknown_charref (self, ref)
 unknown_entityref (self, ref)

Public Attributes

 verbose = verbose
str rawdata = ''
list stack = []
str lasttag = '???'
int nomoretags = 0
int literal = 0

Static Public Attributes

 entity_or_charref
dict entitydefs

Protected Member Functions

 _convert_ref (self, match)

Static Protected Attributes

str _decl_otherchars = '='

Private Attributes

str __starttag_text = None

Constructor & Destructor Documentation

◆ __init__()

Milter.sgmllib.SGMLParser.__init__ ( self,
verbose = 0 )
Initialize and reset this instance.

References reset(), and verbose.

Member Function Documentation

◆ close()

Milter.sgmllib.SGMLParser.close ( self)
Handle the remaining data.

Reimplemented in Milter.sgmllib.TestSGMLParser.

References __starttag_text, _convert_ref(), convert_charref(), convert_entityref(), entity_or_charref, error(), finish_endtag(), finish_shorttag(), finish_starttag(), goahead(), handle_charref(), mime.SGMLFilter.handle_charref(), handle_data(), mime.HTMLScriptFilter.handle_data(), mime.SGMLFilter.handle_data(), handle_endtag(), handle_entityref(), mime.SGMLFilter.handle_entityref(), handle_pi(), handle_starttag(), lasttag, literal, nomoretags, mime.SGMLFilter.parse_declaration(), parse_endtag(), parse_pi(), parse_starttag(), rawdata, report_unbalanced(), stack, unknown_endtag(), mime.SGMLFilter.unknown_endtag(), unknown_starttag(), mime.SGMLFilter.unknown_starttag(), and verbose.

Referenced by Milter.test.TestBase.connect(), and Milter.test.TestBase.feedFile().

◆ convert_charref()

Milter.sgmllib.SGMLParser.convert_charref ( self,
name )
Convert character reference, may be overridden.

References convert_codepoint().

Referenced by close(), and handle_charref().

◆ convert_entityref()

Milter.sgmllib.SGMLParser.convert_entityref ( self,
name )
Convert entity references.

As an alternative to overriding this method; one can tailor the
results by setting up the self.entitydefs mapping appropriately.

References entitydefs.

Referenced by close(), and handle_entityref().

◆ feed()

Milter.sgmllib.SGMLParser.feed ( self,
data )
Feed some data to the parser.

Call this as often as you want, with as little or as much text
as you want (may include '\n').  (This just saves the text,
all the processing is done by goahead().)

References goahead(), and rawdata.

◆ handle_charref()

Milter.sgmllib.SGMLParser.handle_charref ( self,
name )
Handle character reference, no need to override.

References convert_charref(), handle_data(), mime.HTMLScriptFilter.handle_data(), mime.SGMLFilter.handle_data(), and unknown_charref().

Referenced by close().

◆ handle_entityref()

Milter.sgmllib.SGMLParser.handle_entityref ( self,
name )
Handle entity references, no need to override.

References convert_entityref(), handle_data(), mime.HTMLScriptFilter.handle_data(), mime.SGMLFilter.handle_data(), and unknown_entityref().

Referenced by close().

◆ reset()

Milter.sgmllib.SGMLParser.reset ( self)
Reset this instance. Loses all unprocessed data.

References __starttag_text, lasttag, literal, nomoretags, rawdata, and stack.

Referenced by __init__().

◆ setliteral()

Milter.sgmllib.SGMLParser.setliteral ( self,
* args )
Enter literal mode (CDATA).

Intended for derived classes only.

References literal.

◆ setnomoretags()

Milter.sgmllib.SGMLParser.setnomoretags ( self)
Enter literal mode (CDATA) till EOF.

Intended for derived classes only.

References literal, and nomoretags.

Member Data Documentation

◆ entity_or_charref

Milter.sgmllib.SGMLParser.entity_or_charref
static
Initial value:
= re.compile('&(?:'
'([a-zA-Z][-.a-zA-Z0-9]*)|#([0-9]+)'
')(;?)')

Referenced by close().

◆ entitydefs

dict Milter.sgmllib.SGMLParser.entitydefs
static
Initial value:
= \
{'lt': '<', 'gt': '>', 'amp': '&', 'quot': '"', 'apos': '\''}

Referenced by convert_entityref().


The documentation for this class was generated from the following file: