cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: validation of config during build (Was: Re: sitemap validation is broken)
Date Fri, 07 Mar 2003 12:29:17 GMT
Stefano Mazzocchi wrote:

> David Crossley wrote:


>>                          -- o --
>> The other purpose of my original message was to raise an alarm
>> about the change in parameter names in the sitemap, which now
>> do not correspond with code o.a.c.transformation.TraxTransformer
> I'm more and more considering sitemap validation harmful.
> why:
> 1) the sitemap logic is too hard to be validated from any validation 
> language (it requires java runtime capabilitles)
> 2) it reduces the effort of clean and meaningful error messages in the 
> treeprocessor
> Example, try
>  <generate uri="..."/>
> where the uri attribute is not allowed in generate (shoulc be 'src'), 
> the treeprocessor totally ignores this and sends the empty string to 
> the parser, resulting in the error
>  System ID not found!
> Sitemap validation has stopped us from fixing the error messaging 
> capabilities on mistakes.
> I propose to blast the sitemap validation alltogether.

I don't follow you : a schema, although it cannot fully validate a 
sitemap, can easily check syntax inconsistencies like <map:generate 
uri="..."/>. The checks performed by the treeprocessor come at a lower 
lever such as controlling that a used component (type="...") exists, 
check variable expansion syntax, etc.

So it seems to me validation is good to easily write a syntax checker 
and let the java code in treeprocessor concentrate on more detailed 
"semantic" validation.

Now the problem, AFAIU, comes more from the fact that we're trying to 
validate not only the sitemap, but also the configuration of each 
component, which may take very various forms and obey to some 
complicated logic.

Something I've been thinking of long ago (but, as usual, never had the 
time to make real), is a "CheckableConfiguration" : a special 
implementation of the Configuration which would track usage of its data 
and could be queried after use for unused elements or attributes.

This would allow a very simple but complete validation :
- build the sitemap (the whole file is read in a Configuration object),
- lookup once each component in <map:components> to be sure they have 
been configured
- check your CheckableConfiguration for unused items.
Every unused item is a potential syntax error, and you can report them 
all at once.

Thoughts ?


Sylvain Wallez                                  Anyware Technologies 
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }

View raw message