Introduction to XML_Parser
XML_Parser provides an object-oriented abstraction to
PHP's ext/xml. It helps you processing XML documents
by supplying methods that are needed when working with
XML documents, like automatic error handling, parsing
from a file, URL or string as well as an easy way to register
callbacks.
XML_Parser uses SAX-based parsing, which is a simple
API to retrieve information from XML documents. While
the parser reads the document, it will call methods for
the different nodes that are found. These nodes range from
opening and closing tags to character data and processing
instructions.
You will not be able to use XML_Parser directly to parse
your documents, but you have to create a new class that
extends XML_Parser and implement handlers for the tags
and all other elements you need to process.
Several of PEAR's XML packages use this approach and thus
rely on XML_Parser. If you would like to take a look at real-life
examples, just install XML_RDDL, XML_Beautifier, XML_Statistics
or XML_Serializer.