Package Proposal: HTML_Sax
| From: | Harry Fuecks | Date: | Fri, 09 May 2003 22:28:27 +0000 |
| Subject: | Package Proposal: HTML_Sax | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-16078@lists.php.net to get a copy of this message | ||
Hi,
As a first effort towards PEAR, wondering if you're interested in this package; basically a SAX based parser for HTML and other badly formed XML documents. This could prove useful in solving a number of problems such converting HTML to XHTML and fixing other badly formed XML, parsing ASP.NET templates or even as part of a PHP-GTK web browser.
The code is up here; http://www.phppatterns.com/index.php/filemanager/fileview/28/
This was originally a Python project of the same name which was ported to PHP here http://sourceforge.net/projects/phpshelve - I've spoken to the author of the PHP version (Alexander Zhukov) who is no longer maintaining it but has given me permission to use the PHP license instead of LGPL as was published on Sourceforge.
I've made some modifications to Alexander's version to make the HTML_Sax API very similar to the native PHP XML extension (e.g. $parser-
set_object($myHandler); and $parser->set_pi_handler('myPIHandler'); ) so it should be possible to use it which any class designed for the native XML extension as an alternative parser. I've also fixed some bugs and limitations and believe the code is now pretty stable - some basic unit tests are provided. Anyway - more detail in the download.Not so sure about the name. HTMLSax is fairly well known in Python I believe and I think the name conveys what it does but it may cause confusion with the existing PEAR::HTML_* classes which are more about rendering HTML. Changing the name in the code requires only a few minor modifications. Thanks, Harry