sgmllib
index
/usr/lib/python2.1/sgmllib.py

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

 
Modules
            
re
string

 
Classes
            
exceptions.RuntimeError(exceptions.StandardError)
SGMLParseError
SGMLParser
TestSGMLParser

 
class SGMLParseError(exceptions.RuntimeError)
      Exception raised for all parse errors.
 
  
__getitem__(...) from exceptions.Exception
__init__(...) from exceptions.Exception
__str__(...) from exceptions.Exception

 
class SGMLParser
       
  
__init__(self, verbose=0)
# Interface -- initialize and reset this instance
close(self)
# Interface -- handle the remaining data
feed(self, data)
# Interface -- 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().)
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)
# Example -- 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)
# Example -- handle entity reference, 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_comment(self, i)
# Internal -- parse comment, return length or -1 if not terminated
parse_declaration(self, i)
# Internal -- parse declaration.
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)
# Interface -- reset this instance.  Loses all unprocessed data
setliteral(self, *args)
# For derived classes only -- enter literal mode (CDATA)
setnomoretags(self)
# For derived classes only -- enter literal mode (CDATA) till EOF
unknown_charref(self, ref)
unknown_endtag(self, tag)
unknown_entityref(self, ref)
unknown_starttag(self, tag, attrs)
# To be overridden -- handlers for unknown objects

 
class TestSGMLParser(SGMLParser)
       
  
__init__(self, verbose=0)
close(self)
feed(self, data) from SGMLParser
finish_endtag(self, tag) from SGMLParser
finish_shorttag(self, tag, data) from SGMLParser
finish_starttag(self, tag, attrs) from SGMLParser
flush(self)
get_starttag_text(self) from SGMLParser
goahead(self, end) from SGMLParser
handle_charref(self, name) from SGMLParser
handle_comment(self, data)
handle_data(self, data)
handle_decl(self, decl) from SGMLParser
handle_endtag(self, tag, method) from SGMLParser
handle_entityref(self, name) from SGMLParser
handle_pi(self, data) from SGMLParser
handle_starttag(self, tag, method, attrs) from SGMLParser
parse_comment(self, i) from SGMLParser
parse_declaration(self, i) from SGMLParser
parse_endtag(self, i) from SGMLParser
parse_pi(self, i) from SGMLParser
parse_starttag(self, i) from SGMLParser
report_unbalanced(self, tag) from SGMLParser
reset(self) from SGMLParser
setliteral(self, *args) from SGMLParser
setnomoretags(self) from SGMLParser
unknown_charref(self, ref)
unknown_endtag(self, tag)
unknown_entityref(self, ref)
unknown_starttag(self, tag, attrs)

 
Functions
            
test(args=None)

 
Data
             __all__ = ['SGMLParser']
__file__ = '/usr/lib/python2.1/sgmllib.pyc'
__name__ = 'sgmllib'
attrfind = <SRE_Pattern object>
charref = <SRE_Pattern object>
commentclose = <SRE_Pattern object>
commentopen = <SRE_Pattern object>
declname = <SRE_Pattern object>
declstringlit = <SRE_Pattern object>
endbracket = <SRE_Pattern object>
endtagopen = <SRE_Pattern object>
entityref = <SRE_Pattern object>
incomplete = <SRE_Pattern object>
interesting = <SRE_Pattern object>
piclose = <SRE_Pattern object>
piopen = <SRE_Pattern object>
shorttag = <SRE_Pattern object>
shorttagopen = <SRE_Pattern object>
special = <SRE_Pattern object>
starttagopen = <SRE_Pattern object>
tagfind = <SRE_Pattern object>