In short, this is not the case.
SAX parsers are event-based thread-oriented parsers. You register callback functions to handle events such as startElement and endElement, then call parse () to process the entire XML document, at a time, node. To my knowledge, PHP does not have a well-kept SAX parser. However, XMLParser , which uses a very similar Expat .
DOM parsers require you to load an entire XML document into memory, but they provide an object-oriented tree of XML nodes. Examples of DOM parsers in PHP include SimpleXML and DOM .
PHP XMLReader is neither one nor the other. This is a stream-oriented stream parser that requires you to create a large loop and call the read () function to move the cursor forward, processing one node at a time.
The great advantage of XMLParser and XMLReader vs SimpleXML and DOM is that thread-oriented parsers work efficiently with memory by loading only the current node into memory. SimpleXML and the DOM, on the other hand, are easier to use, but they need to load the entire XML document into memory, and this is bad for very large XML documents.
source share