RFR (jaxp) 8136778: SAXParser: support stopping a parsing process

Daniel Fuchs daniel.fuchs at oracle.com
Fri Oct 2 12:44:38 UTC 2015

Hi Joe,

The spec for stop says:

  561      * This method can be called anywhere from any event method of 
  562      * handler. Once called, it does not terminate the parsing process
  563      * immediately. Instead, it will continue finishing and 
returning the
  564      * current event, and marking the state before it stops 
parsing. The
  565      * parsing state is maintained after the process is stopped.

I wonder whether the step should be extended with some more
testcases, calling stop() from various event methods, and not
just endElement() - to validate that stop() resume() will
work as expected.

Also what will happen if resume() is called before the parser
has finished flushing the current event?
Will that work? Or should there be some guards against that?

best regards,

-- daniel

On 30/09/15 23:46, huizhe wang wrote:
> Hi,
> This is an enhancement to allow a SAX parsing process to be stopped and
> resumed. A SAX process scans through an entire document while making
> callbacks to its handler when defined events are met. The stop and
> resume methods make it easy to stop and subsequently resume the process
> as needed. Until now, the parsing process can only be stopped brutally
> by throwing an Exception.
> JBS: http://ccc.us.oracle.com/8136778
> Webrev: http://cr.openjdk.java.net/~joehw/jdk9/8136778/webrev/
> Thanks,
> Joe

More information about the core-libs-dev mailing list