Home   Cover Cover Cover Cover
 

SAX versus XmlReader

question: What is the difference between the push model of a SAX parser (as it is used in the Java XML API ) and the pull model of an XMLReader:

result:

The original SAX push model needs the client to register event handlers, which are triggered when specific XML elements are read. So the SAX parser has the control over the parsing process and informs the client about the elements that were read.

A pull model implements a parsing method where the client has the control over the parsing process. The client tells the pull parser which element it wants to parse next and which elements should be ignored.

Both models, the pull and the push model work forward only with serial access, but for  most of the programmers the pull model is more intuitive to use.