XMLReader is PHP’s implementation of an XML pull parser.
You may have heard of SAX—the Simple API for XML. PHP 4’s DOMXML bears many characteristics of a SAX implementation: parsing the document as a stream, handling each tag as a callback, and complete lack of awareness about what happens before or after the cursor’s location in the file. We have already discussed the disadvantages of DOMXML in Chapter 1.
SimpleXML and DOM both approach XML parsing from a DOM-based perspective. In other words, they create a representation of the entire document in memory. This makes it easy to jump to random locations in the file and move nodes around but takes a toll on system resources.
StAX is an attempt to split ...