cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylvain.wal...@anyware-tech.com>
Subject Re: XMLForm & JSF
Date Tue, 08 Apr 2003 16:58:23 GMT
Hunsberger, Peter wrote:

>Bruno Dumon <bruno@outerthought.org> asked:
>  
>
>>One advantage of commons validator is that it has built-in support for validating
common datatypes like numbers and dates, taking the locale in consideration. BTW, how do you
do such things in schematron, e.g. checking that an entered string is a number?
>>    
>>
>
>I suspect you may know the basics? But in case not:
>
>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.

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.

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

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }



Mime
View raw message