def __init__(self, bufsize = 65536, encoding = 'UTF-8'): XMLReader.__init__(self) SGMLParser.__init__(self) self._bufsize = bufsize self._lexical_handler = None self._encoding = encoding self.documentStarted = 0
def close(self): """This method is called when the entire XML document has been passed to the parser through the feed method, to notify the parser that there are no more data. This allows the parser to do the final checks on the document and empty the internal data buffer. The parser will not be ready to parse another document until the reset method has been called. close may raise SAXException.""" SGMLParser.close(self) self._cont_handler.endDocument()
def feed(self,buffer): if not self.documentStarted: self._cont_handler.startDocument() self.documentStarted = 1 SGMLParser.feed(self,buffer)