Re: Re: Package Proposal: HTML_Sax

From: Date: Sun, 11 May 2003 18:04:27 +0000
Subject: Re: Re: Package Proposal: HTML_Sax
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-16151@lists.php.net to get a copy of this message
On Sun, 11 May 2003 22:51:37 +0800, Alan Knowles <alan@akbkhome.com> wrote:
nice and clean - I personally didnt like the State_Machine :) - as I would have used it as a way to document all the flags rather than writing wrappers for a=1,unset.. isset() etc. eg. just do $this->sm->left_b = 1; if ($this->sm->left_b); ... etc. It will probably speed things up quite a bit as well..
Good point; the states definately need documenting - will update the State_Machine that way.
I was refering to this - http://cvs.php.net/co.php/pear/HTML_Template_Flexy/Flexy/Tokenizer.lex?r=1.23, which is a Lex (as in flex equivialant) its designed to be even lower level than sax/domxml eg.
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.;
It's pretty easy to fix this with flex - you just check the tag if ($tag == 'script') { $this->yystate(IN_SCRIPT); } <IN_SCRIPT> '</[sS][cC][rR][iI][pP]>' { .... store token or whatever.. $this->yystate(IN_SCRIPT); } <IN_SCRIPT> .* .. ignore... / or store as script.. .. it also handles really weird stuff like <sometag a=> <input type crash> , which is better than IE does :)
Starting to make sense ;) Got to take a longer look at Flexy - real interesting.
Anyway - otherwise this code looks great (eg. +1 here) - just repost again with a reminder notice and see if you can get the votes through.. Regards Alan
Many thanks. Will do that.

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