Web / Apache Axiom Interview questions
Why does Axiom use pull parsing instead of push parsing internally?
Axiom is built on StAX, a pull parsing API, rather than SAX, a push API, because pull parsing gives the caller control over the pace of parsing - the application asks for the next event when it's ready, instead of the parser driving events into a handler continuously and unconditionally.
That caller-driven pacing is exactly what Axiom's deferred building depends on: when application code navigates to a part of the tree, Axiom's builder pulls just enough additional StAX events to satisfy that specific request and then stops, rather than being forced to consume the entire remaining document the moment parsing starts.
With a push-based SAX parser, by contrast, the parser itself controls the flow of events into your handler; once started, it keeps firing callbacks for the whole document (or until you throw an exception to stop it), which doesn't naturally support the "build only what's touched" model Axiom is designed around.
In short, pull parsing isn't an incidental implementation detail - it's the mechanism that makes selective, on-demand tree construction possible in the first place.
More Related questions...