XML Pull Parsing is seen as one of the most efficient ways of parsing big documents, especially when the entire document has to be parsed. It has been pretty active in the Java world and in relatively newer languages like C#. For pull parsing the parser should be able to operate in streaming mode. It should not read the entire document in memory, that DOM does, and it should not push content to the client, that SAX does. It should answer when the client queries - the client should be able to pull rather than get the content pushed on it.
Pull parsing has not been very popular in PHP. Elliotte Rusty Harold illustrates pull parsing XML using the XMLReader class inbuilt in PHP 5.
PHP 5 introduced XMLReader, a new class for reading Extensible Markup Language (XML). Unlike SimpleXML or the Document Object Model (DOM), XMLReader operates in streaming mode. That is, it reads the document from start to finish. You can begin to work with the content at the beginning before you see the content at the end. This makes it very fast, very efficient, and very parsimonious with memory. The larger the documents you need to process, the more important this is.
If you see yourself parsing large XML documents in your project, PHP 5 now has an inbuilt solution.


April 18th, 2007 at 11:09 pm
[...] PHP 5 also introduces a class called XMLReader that operates in stream mode and lets you do pull parsing. Pull parsing lets the client pull data from the XML document whenever required, which is perfect [...]
May 14th, 2007 at 10:19 am
[...] the new technologies. PHP 5 has some good features, especially in working with XML and enabling pull parsing. Maybe a transition phase can help, where these tools support both the older and newer versions. [...]