If its resuming an existing parser Papyrix's FB2 support library logs what its doing, sums in pending whitespace, & invokes the resume routine on the XML-parser propagating any errors. Otherwise it (re)opens the file retrieving its filesize, reads an initial chunk to determine text-encoding, creates the XML parser, & registers some callbacks.
For each iteration of that mainloop it periodically pats a watchdog timer & checks whether a callback indicates it should abort.
2/?