Milter.sgmllib.SGMLParser Class Reference
Inheritance diagram for Milter.sgmllib.SGMLParser:

## Public Member Functions

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

## Public Attributes

| verbose
| rawdata
| stack
| lasttag
| nomoretags
| literal

## Static Public Attributes

| entity_or_charref
| entitydefs = \

## Private Member Functions

def | _convert_ref (self, match)

## Private Attributes

| __starttag_text

## Static Private Attributes

string | _decl_otherchars = '='

## Constructor & Destructor Documentation

## __init__()

def Milter.sgmllib.SGMLParser.__init__ | ( |  | self,
|  |  | verbose = `0`
| ) |  |

    Initialize and reset this instance.

Reimplemented in Milter.sgmllib.TestSGMLParser.

References Milter.sgmllib.SGMLParser.reset(), and Milter.sgmllib.SGMLParser.verbose.

## Member Function Documentation

## close()

def Milter.sgmllib.SGMLParser.close | ( |  | self | ) |

    Handle the remaining data.

Reimplemented in Milter.sgmllib.TestSGMLParser.

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

Referenced by Milter.test.TestBase.connect().

## convert_charref()

def Milter.sgmllib.SGMLParser.convert_charref | ( |  | self,
|  |  | name
| ) |  |

    Convert character reference, may be overridden.

References Milter.sgmllib.SGMLParser.convert_codepoint().

Referenced by Milter.sgmllib.SGMLParser.close(), and Milter.sgmllib.SGMLParser.handle_charref().

## convert_entityref()

def 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 Milter.sgmllib.SGMLParser.entitydefs.

Referenced by Milter.sgmllib.SGMLParser.close(), and Milter.sgmllib.SGMLParser.handle_entityref().

## feed()

def 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 Milter.sgmllib.SGMLParser.goahead(), and Milter.sgmllib.SGMLParser.rawdata.

## handle_charref()

def Milter.sgmllib.SGMLParser.handle_charref | ( |  | self,
|  |  | name
| ) |  |

    Handle character reference, no need to override.

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

Referenced by Milter.sgmllib.SGMLParser.close().

## handle_entityref()

def Milter.sgmllib.SGMLParser.handle_entityref | ( |  | self,
|  |  | name
| ) |  |

    Handle entity references, no need to override.

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

Referenced by Milter.sgmllib.SGMLParser.close().

## reset()

def Milter.sgmllib.SGMLParser.reset | ( |  | self | ) |

    Reset this instance. Loses all unprocessed data.

References Milter.sgmllib.SGMLParser.__starttag_text, Milter.sgmllib.SGMLParser.lasttag, Milter.sgmllib.SGMLParser.literal, Milter.sgmllib.SGMLParser.nomoretags, Milter.sgmllib.SGMLParser.rawdata, and Milter.sgmllib.SGMLParser.stack.

Referenced by Milter.sgmllib.SGMLParser.__init__().

## setliteral()

def Milter.sgmllib.SGMLParser.setliteral | ( |  | self,
|  | * | args
| ) |  |

    Enter literal mode (CDATA).

    Intended for derived classes only.

References Milter.sgmllib.SGMLParser.literal.

## setnomoretags()

def Milter.sgmllib.SGMLParser.setnomoretags | ( |  | self | ) |

    Enter literal mode (CDATA) till EOF.

    Intended for derived classes only.

References Milter.sgmllib.SGMLParser.literal, and Milter.sgmllib.SGMLParser.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 Milter.sgmllib.SGMLParser.close().

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

- Milter/sgmllib.py