You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Van Riper, Mike" <mv...@verisign.com> on 2002/12/06 21:57:48 UTC

Validation DTD bug?

Before submitting a bug report on this, I wanted to verify that I am doing
this correctly. This isn't causing any real runtime problems at this point.
I just discovered the problem when I turned on DTD validation in my IDE. I
am working with the 1.1-b2 release, but, I checked and the same problem
exists in the 20021206 nightly build. The validation_1_1.dtd file has the
following element definition for "field" elements:

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

Shouldn't this be:

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

Unless I am missing something, the DTD should allow for multiple definitions
of each subelement in a "field" element definition. As an example of why
this is so, I have a validation definition for a field that has both minimum
and maximum length validations specified. The error messages for both of
these validations want to insert the number for the minimum or maximum
length as the "arg1" value. So, I need more than one "arg1" definition
inside the 'field" definition. The example from my working application is:

      <field property="zip" depends="required,minlength,maxlength,mask">
        <msg name="mask" key="msg.zip.invalid"/>
        <arg0 key="prompt.zip"/>
        <arg1 name="minlength" key="${var:minlength}" resource="false"/>
        <arg1 name="maxlength" key="${var:maxlength}" resource="false"/>
        <var>
          <var-name>minlength</var-name>
          <var-value>5</var-value>
        </var>
        <var>
          <var-name>maxlength</var-name>
          <var-value>10</var-value>
        </var>
        <var>
           <var-name>mask</var-name>
           <var-value>${zipLong}</var-value>
        </var>
      </field>

This example from my code only requires multiple "arg1" definitions, but,
the same principle applies to the other "arg" fields. Similarly, I could
contrive an example that would require multiple definitions for "msg". The
convention in the examples provided with the release always reserve "arg0"
for the display name of the field. So, I suppose you could make an argument
for not needing support for multiple "arg0" elements. Still, the DTD
probably shouldn't rely on that convention.

- Mike Van Riper
  mvanriper@verisign.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>