| |
- XMLParser
-
- TestXMLParser
class TestXMLParser(XMLParser) |
|
no doc string |
| |
- __init__(self)
- no doc string
- close(self)
- no doc string
- flush(self)
- no doc string
- handle_cdata(self, data)
- no doc string
- handle_comment(self, data)
- no doc string
- handle_data(self, data)
- no doc string
- handle_doctype(self, tag, pubid, syslit, data)
- no doc string
- handle_entity(self, name, strval, pubid, syslit, ndata)
- no doc string
- handle_proc(self, name, data)
- no doc string
- handle_xml(self, encoding, standalone)
- no doc string
- syntax_error(self, message)
- no doc string
- unknown_charref(self, ref)
- no doc string
- unknown_endtag(self, tag)
- no doc string
- unknown_entityref(self, ref)
- no doc string
- unknown_starttag(self, tag, attrs)
- no doc string
|
class XMLParser |
|
# XML parser base class -- find tags and call handler functions.
# Usage: p = XMLParser(); p.feed(data); ...; p.close().
# The dtd is defined by deriving a class which defines methods with
# special names to handle tags: start_foo and end_foo to handle <foo>
# and </foo>, respectively. The data between tags is passed to the
# parser by calling self.handle_data() with some data as argument (the
# data may be split up in arbutrary chunks). Entity references are
# passed by calling self.handle_entityref() with the entity reference
# as argument.
|
| |
- __fixclass(self, kl)
- no doc string
- __fixdict(self, dict)
- no doc string
- __fixelements(self)
- no doc string
- __init__(self)
- # 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_starttag(self, tagname, attrdict, method)
- # Internal -- finish processing of start tag
- 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_cdata(self, data)
- # Example -- handle cdata, could be overridden
- 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_doctype(self, tag, pubid, syslit, data)
- # Overridable -- handle DOCTYPE
- handle_endtag(self, tag, method)
- # Overridable -- handle end tag
- handle_entityref(self, name)
- # Example -- handle entity reference, no need to override
- handle_proc(self, name, data)
- # Example -- handle processing instructions, could be overridden
- handle_starttag(self, tag, method, attrs)
- # Overridable -- handle start tag
- handle_xml(self, encoding, standalone)
- # Overridable -- handle xml processing instruction
- parse_attributes(self, tag, i, j)
- # Internal -- parse attributes between i and j
- parse_cdata(self, i)
- # Internal -- handle CDATA tag, return length or -1 if not terminated
- parse_comment(self, i)
- # Internal -- parse comment, return length or -1 if not terminated
- parse_doctype(self, res)
- # Internal -- handle DOCTYPE tag, return length or -1 if not terminated
- parse_endtag(self, i)
- # Internal -- parse endtag
- parse_proc(self, i)
- # Internal -- handle a processing instruction tag
- parse_starttag(self, i)
- # Internal -- handle starttag, return length or -1 if not terminated
- 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
- syntax_error(self, message)
- # Example -- handle relatively harmless syntax errors, could be overridden
- translate_references(self, data, all=1)
- # Interface -- translate references
- unknown_charref(self, ref)
- # To be overridden -- handlers for unknown objects
- unknown_endtag(self, tag)
- # To be overridden -- handlers for unknown objects
- unknown_entityref(self, ref)
- # To be overridden -- handlers for unknown objects
- unknown_starttag(self, tag, attrs)
- # To be overridden -- handlers for unknown objects
| |