sgmllib
index
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sgmllib.py
Module Docs

A parser for SGML, using the derived class as a static DTD.

 
Modules
       
markupbase
re

 
Classes
       
exceptions.RuntimeError(exceptions.StandardError)
SGMLParseError
markupbase.ParserBase
SGMLParser

 
class SGMLParseError(exceptions.RuntimeError)
    Exception raised for all parse errors.
 
 
Method resolution order:
SGMLParseError
exceptions.RuntimeError
exceptions.StandardError
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.RuntimeError:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature

Data and other attributes inherited from exceptions.RuntimeError:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
class SGMLParser(markupbase.ParserBase)
     Methods defined here:
__init__(self, verbose=0)
Initialize and reset this instance.
close(self)
Handle the remaining data.
convert_charref(self, name)
Convert character reference, may be overridden.
convert_codepoint(self, codepoint)
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.
error(self, message)
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 '
').  (This just saves the text,
        all the processing is done by goahead().)
finish_endtag(self, tag)
# Internal -- finish processing of end tag
finish_shorttag(self, tag, data)
# Internal -- finish parsing of <tag/data/ (same as <tag>data</tag>)
finish_starttag(self, tag, attrs)
# Internal -- finish processing of start tag
# Return -1 for unknown tag, 0 for open-only tag, 1 for balanced tag
get_starttag_text(self)
goahead(self, end)
# Internal -- handle data as far as reasonable.  May leave state
# and data to be processed by a subsequent call.  If 'end' is
# true, force handling all data as if followed by EOF marker.
handle_charref(self, name)
Handle character reference, no need to override.
handle_comment(self, data)
# Example -- handle comment, could be overridden
handle_data(self, data)
# Example -- handle data, should be overridden
handle_decl(self, decl)
# Example -- handle declaration, could be overridden
handle_endtag(self, tag, method)
# Overridable -- handle end tag
handle_entityref(self, name)
Handle entity references, no need to override.
handle_pi(self, data)
# Example -- handle processing instruction, could be overridden
handle_starttag(self, tag, method, attrs)
# Overridable -- handle start tag
parse_endtag(self, i)
# Internal -- parse endtag
parse_pi(self, i)
# Internal -- parse processing instr, return length or -1 if not terminated
parse_starttag(self, i)
# Internal -- handle starttag, return length or -1 if not terminated
report_unbalanced(self, tag)
# Example -- report an unbalanced </...> tag.
reset(self)
Reset this instance. Loses all unprocessed data.
setliteral(self, *args)
Enter literal mode (CDATA).
 
Intended for derived classes only.
setnomoretags(self)
Enter literal mode (CDATA) till EOF.
 
Intended for derived classes only.
unknown_charref(self, ref)
unknown_endtag(self, tag)
unknown_entityref(self, ref)
unknown_starttag(self, tag, attrs)
# To be overridden -- handlers for unknown objects

Data and other attributes defined here:
entity_or_charref = <_sre.SRE_Pattern object>
entitydefs = {'amp': '&', 'apos': "'", 'gt': '>', 'lt': '<', 'quot': '"'}

Methods inherited from markupbase.ParserBase:
getpos(self)
Return current line number and offset.
parse_comment(self, i, report=1)
# Internal -- parse comment, return length or -1 if not terminated
parse_declaration(self, i)
# Internal -- parse declaration (for use by subclasses).
parse_marked_section(self, i, report=1)
# Internal -- parse a marked section
# Override this to handle MS-word extension syntax <![if word]>content<![endif]>
unknown_decl(self, data)
# To be overridden -- handlers for unknown objects
updatepos(self, i, j)
# Internal -- update line number and offset.  This should be
# called for each piece of data exactly once, in order -- in other
# words the concatenation of all the input strings to this
# function should be exactly the entire input.

 
Data
        __all__ = ['SGMLParser', 'SGMLParseError']