I am searching for the main difference between SAX and Pull Parser . I know the SAX parser is good for handling the large XML file as it does not store the XML and traverse in only one direction. as compared to DOM. But I am unable to find the major difference between SAX and PULL. Please suggest me any link
The difference is the way you code your XML processor. For the SAX parser you use an event driven model where you supply a class which has methods to respond to the events which occur while the XML is being read (Oracle tutorial here).
For the pull parser you have more control over when bits of the XML get read and you can pass the parser handle around to various classes to handle different bits of the document (Oracle tutorial here).
Oracle's comparison of the technologies can be found here.
When Parser calls your handler, i.e. Parser pushes the event into your handler it is called Push Model of Parser, eg. SAX Parser
SAX Parser --> Handler
With push model, you do not have control over how and when the parsed iterates over the file.
When Handler class calls the parser or when handler class controls the parser when to move on the next event is called the Pull Parser. Here Handler "pulls" the XML event out of the parser. eg. StAX
Handler --> StAX Parser
for more information , please read http://tutorials.jenkov.com/java-xml/sax-vs-stax.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With