[PHPTAL] back to the dom parser idea
Kornel Lesinski
kornel at aardvarkmedia.co.uk
Mon Jan 28 13:25:20 CET 2008
>>>>
>>>> There are issues with DOM itself:
>>>> - it doesn't report line numbers for elements, so error messages
>>>> (other than parse errors) can't include them. Not very user-
>>>> friendly :(
>>>
>>> It does! Just need to disable libxml error reporting, so no
>>> warnings etc are generated, then pull the errors by hand.
>>
>> But is there a way to get line number of any element if there were
>> no parse errors? Things like invalid TALES expressions need to
>> report line number, but aren't libxml's concern.
>
> Then we validate using XML Schema or RelaxNG ;)
It's not possible (e.g. there can be runtime errors caused by invalid
data, there can be user-defined expression modifiers, etc.)
>>
>> What DOCTYPE do you suggest? Document with XHTML DTD and TAL
>> attributes won't be valid, so something else is necessary.
>
> No... well... could in theory append an HTML doctype to the
> document, or an inline DTD with the entitiy definitions. Not a big
> problem :)
That wouldn't be more elegant than hack there is currently (which is
a regular expression that replaces entity names with numeric
references).
>>
>> However optional parentheses with arguments for function calls
>> sound like a good idea. This can be done without a complete
>> rewrite of PHPTAL :)
>
> But we should still do that! ;)
>
> Seriously, I'll be able to help with this stuff. Can dedicate a
> good amount of time if we decide to start over, making proper
> plans, roadmaps, feature sets etc. It would be an excellent effort
> I think.
I'm all for writing PHPTAL 2, but I'm not so keen on doing it from
scratch. I don't want to create dilemma when users have to choose
between version that is stable, feature-complete, but old and
unmaintained and a new one that's still work-in-progress.
Current code isn't very bad (worst parts are like 0.0001 on
osCommerce scale ;) and has a nice test suite that helps refactoring
a lot.
I suggest that we replace current PHPTAL's code piece-by-piece
(replace dom parser, tales parser, code-generator, etc.), and
eventually we'll end up with completely new code, but in the
meantime, there always will be one usable version available.
--
regards, Kornel
More information about the PHPTAL
mailing list