Search code examples
javagarbage-collectionsaxparserxmlpullparser

What is the difference between XML Pull Parser and SAX Parser


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


Solution

  • 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.