» Summary | » License |
---|---|
A framework for building XML filters using the SAX API | PHP |
» Current Release | » Bug Summary |
0.3.0 (beta) was released on 2004-04-20 by hfuecks (Changelog) |
No open bugs Report a new bug to XML_SaxFilters |
» Description | |
XML_SaxFilters provides a foundation for using Sax filters in PHP. The original code base was developed by Luis Argerich and published at phpxmlclasses.sourceforge.net/show_doc.php?class=class_sax_filters.html. Luis discussed how SaxFilters work, using the Sourceforge classes as an example, in Chapter 10 of Wrox "PHP 4 XML". Luis kindly gave permission to modify the code and license for inclusion in PEAR. This version of the Sax Filters makes significant changes to Luis's original code (backwards compatibility is definately broken), seperating abstract classes from interfaces, providing interfaces for data readers and writers and providing methods to help parse XML documents recursively with filters (for example AbstractFilter::setParent()) for documents where the structure can vary significantly. Sax Filtering is an approach to making parsing XML documents with Sax modular and easy to maintain. The parser delegates events to a child filter which may in turn delegate events to another filter. In general it's possible to implement filters for a document which are as flexible and powerful as DOM. For some discussions on Sax filtering try; http://www.cafeconleche.org/books/xmljava/chapters/ch08.html (Java) http://www-106.ibm.com/developerworks/xml/library/x-tipsaxflex.html (Python) http://www.xml.com/pub/a/2001/10/10/sax-filters.html (Perl) The API provided by XML_SaxFilters is a little different from that commonly used in other languages, providing the concepts of "parent" and "child". A parent of the current filter is the filter (or parser) "upsteam" which receive XML event notifications before the current filter. A "child" is a filter "downstream" of the current filter (or parser) to which XML events are delegated. The top of the "family tree" of filters is always the parser itself, which can have children but cannot have parents. Filters can have parents and children. The parsers themselves never handle any XML events personally but always delegate to a filter. The parser accepts an object implementing the reader interface from which it streams the XML. The filters can be given an object implementing the writer interface to write output to. For an example of SAX filters in action with PHP try; http://www.phppatterns.com/index.php/article/articleview/48/1/2/ (example uses Luis Argerich original Sax Filters). |
|
» Maintainers | » More Information |
|