[opencms-dev] Bug in Schema validationrules? Or documentation Problem?

Anthony Roy aroy at hpi.co.uk
Wed Aug 2 13:41:41 CEST 2006


Hi all,

I am playing with the validationrules in a schema I have written, and
have come across a bug in either the validation routine or the
documentation (Step 3: Advanced XSD configuration). My rules are as
follows:

<validationrules>
   <rule element="Id" regex="\S+" message="No spaces Dude!" />
   <rule element="Id" regex=".{0,12}" message="Id too long!" />
   <rule element="Id" regex=".{4,}" message="Id too short!" />
</validationrules>

I had assumed that the validation would apply each rule in turn, but
what appears to happen is that later rules simply overwrite previous
ones.

For example in the above case, trying to save a page with the Id set to
"hghjghjkkhjkhjkkh" gives no error messages, "hh" on the other hand
gives the message "Id too short!" as expected. Rearranging the rules so
that the "Id too long!" rule is last gives the correct error message for
"hghjghjkkhjkhjkkh", but allows either "hh" or "kk hh" to be saved.

Regardless of whether this is a bug or documentation problem, does
anyone know of a way to give different error messages for different
rules? Simply changing to:

<validationrules>
   <rule element="Id" regex="\S{4,12}" message="Id must have no spaces
and be between 4 and 12 characters long!" />
</validationrules>

doesn't provide very specific information.

Anthony Roy. 


This email and any files transmitted with it are confidential and are intended solely for the use of the individual or entity to whom they are addressed. This communication represents the originator's personal views and opinions, which do not necessarily reflect those of HPI Limited. If you are not the original recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error, and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you received this email in error, please immediately notify postmaster at hpi.co.uk.This message has been scanned by Anti-Virus. Recipients are advised to apply their own virus checks to this message on delivery.




More information about the opencms-dev mailing list