libearth.compat.xmlpullreader
— Pulling SAX parser¶
-
class
libearth.compat.xmlpullreader.
PullReader
¶ SAX parser interface which provides similar but slightly less power than
IncremenetalParser
.IncrementalParser
can feed arbitrary length of bytes while it can’t determine how long bytes to feed.-
close
()¶ 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 raiseSAXException
.Raises: xml.sax.SAXException – when something goes wrong
-
feed
()¶ This method makes the parser to parse the next step node, emitting the corresponding events.
feed()
may raiseSAXException
.Returns: whether the stream buffer is not empty yet Return type: bool
Raises: xml.sax.SAXException – when something goes wrong
-
prepareParser
(iterable)¶ This method is called by the parse implementation to allow the SAX 2.0 driver to prepare itself for parsing.
Parameters: iterable ( collections.Iterable
) – iterable ofbytes
-
reset
()¶ This method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.
-