Re: Package Proposal: HTML_Sax
| From: | Harry Fuecks | Date: | Sat, 10 May 2003 11:16:52 +0000 |
| Subject: | Re: Package Proposal: HTML_Sax | ||
| References: | 1 2 | Groups: | php.pear.dev php.pear.dev |
| Request: | Send a blank email to pear-dev+get-16103@lists.php.net to get a copy of this message | ||
Hi Alan,
OK - have put the sources are up here;
http://code.phppatterns.com/HTML_Sax/HTML_Sax.phps
http://code.phppatterns.com/HTML_Sax/State_Machine.phps
http://code.phppatterns.com/HTML_Sax/Attributes_Parser.phps
And there's a couple of examples here;
http://code.phppatterns.com/HTML_Sax/examples/HTMLtoXHTML.phps
http://code.phppatterns.com/HTML_Sax/examples/SimpleExample.phps
API docs are up here;
http://code.phppatterns.com/HTML_Sax/docs/
Don't have much experience of the tokenizer extension - I guess that would be something equivalent to the DOM API for HTML?
So far I haven't been able to break HTML_Sax as such but there are some situations right now where it won't behave exactly as expected e.g.;
<script language="javascript">
document.write('<b>Hello World!</b>');
</script>
Would trigger events for the <b> and </b> elements. The workaround is;
<script language="javascript">
<!--
document.write('<b>Hello World!</b>');
-->
</script>
Overall, it doesn't really care about whether the "overall picture" of a document makes sense to it - it simply triggers events every time it encounters something looking like a tag - it other words its up to the handler methods to decide what to do with events - probably this example http://code.phppatterns.com/HTML_Sax/examples/HTMLtoXHTML.phps demonstates that - the handler works for the example.html page but might not produce decent XHTML for other pages.
Regards,
Harry
On Sat, 10 May 2003 12:00:12 +0800, Alan Knowles <alan@akbkhome.com> wrote:
Can you make phps available please, I presume it's a hand based tokenizer/parser, I did a few of these before but was never very happy with them (they tended to break easily..), which is why I went down the road of using a lexer in flexy.. - which might worth breaking out as HTML_Lex one day.. Regards Alan