PHP not have a "standard SAX" interface for event-driven XML parse, have a Expat one. Expat require --enable-libxml
option... But LibXML2 have a good and fast standard SAX interface (!)... So, how to access the LibXML2's standard SAX interface with PHP?
There are a simple workaround to enable the SAX interface?
Related question: Is XMLReader a SAX parser, a DOM parser, or neither?
Terminology (to say the "same language" in the discussions):
event-driven XML parser: SAX and Expat, they was 1998's "competidors", but today (2013's) are only a "reference model for interfacing the parser implementation".
event-driven XML parser implementations: see LibXML2, expat.sourceforge, Oracle/Java/SAX, etc. They are "concrete implementations" (can generate binary code for the parser).
SAX interface: an abstraction based on the "SAX reference model", see saxproject.org and Wikipedia.
Expat interface: an abstraction based on the "Expat reference model", see jclark.com/xml and Wikipedia.
PHP's XML Parser conventions for an event-driven XML parser interface... Is a Expat interface but, it is over the Expat or the LibXML2 implementation??
PHP's SAX interface: not exist (!), but can be build as more one LibXML2 interface?
PHP's "other XML parser interfaces": remember that DomDocument, XSLTProcessor, etc. are PHP interfaces to the LibXML2 implementations.
PS: please edit this text for better or detailed explanations... Detailing "library interface": is a set of function names, methods and properties, used as "module interface" between PHP (for programmers abstrations) and a library implementation (drivers, etc. for assembler/binary concrete implementation).
来源:https://stackoverflow.com/questions/18656457/php-not-have-access-to-the-libxml2-sax-interface