In a pull API the client program drives the parser. Just a tad more than a year ago, I wrote an article for discussing what until now has been the primary pull API, XMLPULL.

javax xml stream isvalidating-19

A streaming API uses much less memory than a tree API since it doesn't have to hold the entire document in memory simultaneously. They don't have to build excessively complicated tree data structures they'll just pull apart again into smaller pieces.

However, the common streaming APIs like SAX are all push APIs.

They feed the content of the document to the application as soon as they see it, whether the application is ready to receive that data or not.

Most current XML APIs fall into one of two broad classes: event-based APIs like SAX and XNI or tree-based APIs like DOM and JDOM.

Most programmers find the tree-based APIs to be easier to use; but such APIs are less efficient, especially with respect to memory usage.

An in-memory tree tends to be several times larger than the document it models.Thus tree APIs are normally not practical for documents larger than a few megabytes in size or in memory constrained environments such as J2ME.SAX and XNI are fast and efficient, but the patterns they require programmers to adopt are unfamiliar and uncomfortable to many developers.Pull APIs are a more comfortable alternative for streaming processing of XML.A pull API is based around the more familiar iterator design pattern rather than the less well-known observer design pattern.In a pull API, the client program asks the parser for the next piece of information rather than the parser telling the client program when the next datum is available.