cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hunsberger, Peter" <>
Subject RE: XMLForm & JSF
Date Tue, 08 Apr 2003 17:47:11 GMT
Sylvain Wallez <> wrote:


> >
> >With Schematron you can use any test that is valid Xpath or XSLT.  
> >Thus, functions like "number()", "starts-with()", 
> "contains()" work as 
> >expected, but you can also have more complicated dependency checking 
> >like "boolean(foo)" to assert that an element must have a 
> child "foo" 
> >element, etc.
> >
> This won't work with XMLForm, since validation (i.e. schematron) is 
> performed _after_ population. And population is handled by 
> JXPath using 
> the standard JavaBean mechanisms, and as such follows some very basic 
> syntactic rules.

Too bad; the obvious solution is to run validation before population...

> This means you can't define custom formats to parse request 
> parameters 
> to fill the model. You only can chek _afterwards_ that a 
> syntactically 
> correct input matches certain criteria. Although this perfectly fits 
> constraints like checking an e-mail address format (stored as 
> a String), 
> this doesn't allow to use a for example a particular format 
> for date input.

Well, you can always store everything as a String and post validate, but
that's likely an unreasonable restriction.

> And this is where Commons validator shines, since you can define the 
> format for parsing the value that is used for populating the model.

It seems to me it's not only a parse failure that determine validation
failure? Though if so, I suspect this is why I couldn't figure out how to do
cross element checking (though I didn't spend much time trying)?  Ie;
test="x='foo' and y='bar'".  Do you know if that is possible?

So the question comes down to: is it necessary to perform validation
after/concurrent with model population?  I can see that in some frameworks
you might want to do this in order to make sure that valid values round trip
back, but in our current framework that's not an issue (they come back via
inspection of the aggregated request data).  I'd certainly rather be sure
I'm dealing with valid values when I go to populate a model, but then again,
maybe that's just me.... ;-)

View raw message