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

## 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
| rawdata
| stack
| lasttag
| nomoretags
| literal

## Static Public Attributes

| entity_or_charref
dict | entitydefs

## Protected Member Functions

| _convert_ref (self, match)

## Protected Attributes

| _convert_ref

## Static Protected Attributes

str | _decl_otherchars = '='

## Private Attributes

| __starttag_text

## Constructor & Destructor Documentation

## __init__()

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()

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_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(), Milter.sgmllib.SGMLParser.handle_data(), Milter.sgmllib.TestSGMLParser.handle_data(), mime.SGMLFilter.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, Milter.sgmllib.SGMLParser.unknown_endtag(), Milter.sgmllib.TestSGMLParser.unknown_endtag(), mime.SGMLFilter.unknown_endtag(), mime.SGMLFilter.unknown_starttag(), Milter.sgmllib.SGMLParser.unknown_starttag(), Milter.sgmllib.TestSGMLParser.unknown_starttag(), and Milter.sgmllib.SGMLParser.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 Milter.sgmllib.SGMLParser.convert_codepoint().

Referenced by Milter.sgmllib.SGMLParser.close(), and Milter.sgmllib.SGMLParser.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 Milter.sgmllib.SGMLParser.entitydefs.

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

## handle_charref()

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

    Handle character reference, no need to override.

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

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

## handle_entityref()

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

    Handle entity references, no need to override.

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

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

## reset()

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()

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

    Enter literal mode (CDATA).

    Intended for derived classes only.

References Milter.sgmllib.SGMLParser.literal.

## setnomoretags()

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().

## entitydefs

dict Milter.sgmllib.SGMLParser.entitydefs

static

Initial value:
= \
{'lt': '<', 'gt': '>', 'amp': '&', 'quot': '"', 'apos': '\''}

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

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

- Milter/sgmllib.py