Re: Package Proposal: HTML_Sax

From: Date: Sat, 10 May 2003 11:46:01 +0000
Subject: Re: Package Proposal: HTML_Sax
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-16106@lists.php.net to get a copy of this message
That's great news. And had no idea that DOM could handle badly formed XML (HTML) as well. One other thing - is there anything looking at SAX filters in PEAR (or otherwise) right now (can't find anything). Really like what Luis Argerich has done with Sax filters here: http://phpxmlclasses.sourceforge.net/show_doc.php?class=class_sax_filters.html - would be good to see something like this become part of PEAR as well. On Sat, 10 May 2003 13:25:09 +0200 (CEST), Christian Stocker <chregu@bitflux.ch> wrote:
Just For your information libxml2 is able to parse HTML documents and to produce SAX Events with it. As sterling now made a libxml2 based sax interface, it shouldn't be a big deal to support HTML Documents for SAX as well (domxml does it since quite some time) This does not say, that there shouldn't be a PHP based HTML_Sax class :) chregu On Sat, 10 May 2003, Harry Fuecks wrote:
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


« previous php.pear.dev (#16106) next »