[Typo3-dev] Validating TypoScript - Schema vs. DTD

Elmar Hinz elmar.DOT.hinz at team.MINUS.red.DOT.net
Tue Nov 29 20:24:39 CET 2005


Hi Dmitry,

I think first comes the syntax check, then comes the validation. I am 
looking for a way to validate TS. My question is: "Is it possible to 
check the semantic of TS?"

syntax check => it is well formed

semantic check (validation) => it is valid

> How about doing it in a slightly different way:
> 
> <page name="page">
>     <html name="10">
>          <value>Test</value>
>          <if><value>2></value><equals>1</equals></if>
>     </html>
>     <coa name="20">
>           <html name="10"><value>test2</value></html>
>     </coa>
> </page>
> 
> In outher words, a typoscript object type would corellate to XML
> element type, and the identifier will be stored in "name" or any other
> attribute.
> 

How do you know during transformation from TS to XML that you have 
transform page to an attribute while you transform value as an elment? 
For that you would need to know something about semantics if TS. But 
here we are still on the way to prepare the validation.

> The bigger problem, is, however, "stray" definitions, where you, say,
> misspell "config" or some other config variable, and, while it will be
> perfectly normal TypoScript it will not produce the results you want.
> 

You could transform it to XML and it would pass checks for 
wellformedness in XML, too. But it wouldn't pass validation. That's 
exactly the idea of it. By validation you would locate the error.

> If you are validating the syntax only I would say XML->DTD validation

"validating the syntax". IMHO that is nonsens.

* Checking the syntax.
* Validating the semantics.

> is not the way to go. I don't think you can enforce some of TypoScript
> syntax rules through DTD (for example, multi-line values in ( ) ).
> 
> I would probably look at other syntax parsers available (bison, lexx?).

Syntax check isn't the problem. That is already implemented in the TS 
manger.

Regards

Elmar


-- 
Climate change 2005: Mexico, Guatemala, New Orleans, Sahel, Bangladesh,
Spain, Portugal, Austria, Swiss, France, ...
Production of CO2 is killing people.
Production of CO2 just for fun is killing people just for fun.




More information about the TYPO3-dev mailing list