commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Van Riper, Mike" <>
Subject Is this a validator DTD bug?
Date Thu, 12 Dec 2002 21:19:22 GMT
I have a working Struts 1.1-b2 based webapp that uses the validation
framework. My validation.xml file doesn't validate successfully against this
DTD requirement:

  <!ELEMENT field  (msg?, arg0?, arg1?, arg2?, arg3?, var* )>

because when I use both the minlength and maxlength validations on a single
field, I end up with more than one <arg1> element inside the field element
definition like so:

      <field property="zip" depends="minlength,maxlength">
        <arg0 key=""/>
        <arg1 name="minlength" key="${var:minlength}" resource="false"/>
        <arg1 name="maxlength" key="${var:maxlength}" resource="false"/>

Unless the <arg1> is defined separately for minlength and maxlength
validations, it is not possible to generate the correct validation error
message with the appropriate minlength or maxlength value inserted in the
error message. This is why I believe that the DTD needs to change like so:

  <!ELEMENT field  (msg*, arg0*, arg1*, arg2*, arg3*, var* )>

Otherwise, you are *not* allowed to specify different <msg> or <argx> values
when multiple validation rules are being used. I already posted this on the
struts-user list, but, James Holmes recommended that I post it directly to
the Commons list as the Validator is part of the Commons now.

I realize that in all the examples arg0 is used by convention for the
display name of the field. Even in my webapp, that one could be left as
"arg0+" without causing any problems. However, I don't think the framework
should rely on that convention. So, it would be best to make them all allow
zero or more (*) rather than zero or one (+) occurrences.

If I were setup so that I could easily submit the CVS diff in a bug report,
I would. If it would help, I'd be glad to submit this as a bug report though
without the CVS diff for tracking purposes.

- Mike Van Riper

View raw message