2
DTD for the Validator Rules Configuration File, Version 1.2.0
4
To allow for XML validation of your rules configuration
5
file, include the following DOCTYPE element at the beginning (after
6
the "xml" declaration):
8
<!DOCTYPE form-validation PUBLIC
9
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.2.0//EN"
10
"http://jakarta.apache.org/commons/dtds/validator_1_2_0.dtd">
12
$Id: validator_1_2_0.dtd,v 1.8 2004/11/12 16:02:52 niallp Exp $
18
The "form-validation" element is the root of the configuration file
19
hierarchy, and contains nested elements for all of the other
20
configuration settings.
22
<!ELEMENT form-validation (global*, formset*)>
26
The elements defined here are all global and must be nested within a
29
<!ELEMENT global (validator*, constant*)>
33
Defines what validator objects can be used with
34
the fields referenced by the formset elements.
36
validator Defines a new validatior
37
javascript The javascript source code for client side validation.
39
name The name of this validation
40
classname The java class name that handles server side validation
41
method The java method that handles server side validation
42
methodParams The java class types passed to the serverside method
43
msg a generic message key to use when this validator fails.
44
It can be overridden by the 'msg' element for a specific field.
45
depends The comma-delimited list of validator that are called before this validator.
46
For this validation to succeed, all the listed validators must succeed.
47
jsFunctionName The name of the javascript function which returns all fields of a certain type.
48
jsFunction The name of the javascript function which is passed the form for validation.
51
<!ELEMENT validator (javascript?)>
52
<!ATTLIST validator name CDATA #REQUIRED>
53
<!ATTLIST validator classname CDATA #REQUIRED>
54
<!ATTLIST validator method CDATA #REQUIRED>
55
<!ATTLIST validator methodParams CDATA #REQUIRED>
56
<!ATTLIST validator msg CDATA #REQUIRED>
57
<!ATTLIST validator depends CDATA #IMPLIED>
58
<!ATTLIST validator jsFunctionName CDATA #IMPLIED>
59
<!ATTLIST validator jsFunction CDATA #IMPLIED>
64
Defines a JavaScript that can be used to perform
65
client-side validators.
67
<!ELEMENT javascript (#PCDATA)>
71
Defines a static value that can be used as
72
replacement parameters within "field" elements. The "constant-name" and
73
"constant-value" elements define the constant's reference id and replacement
76
<!ELEMENT constant (constant-name, constant-value)>
77
<!ELEMENT constant-name (#PCDATA)>
78
<!ELEMENT constant-value (#PCDATA)>
82
Defines a set of forms for a locale. Formsets for
83
specific locales can override only those fields that change. The
84
localization is properly scoped, so that a formset can override just the
85
language, or just the country, or both.
87
<!ELEMENT formset (constant*, form+)>
88
<!ATTLIST formset language CDATA #IMPLIED>
89
<!ATTLIST formset country CDATA #IMPLIED>
90
<!ATTLIST formset variant CDATA #IMPLIED>
94
Defines a set of fields to be validated. The name
95
corresponds to the identifier the application assigns to the form.
97
<!ELEMENT form (field+)>
98
<!ATTLIST form name CDATA #REQUIRED>
99
<!ATTLIST form extends CDATA #IMPLIED>
104
Defines the properties to be validated. In a
105
web application, a field would also correspond to a control on
106
a HTML form. To validate the properties, the validator works through
107
a JavaBean representation. The field element accepts these
110
property The property on the JavaBean corresponding to this
113
depends The comma-delimited list of validators to apply against
114
this field. For the field to succeed, all the
115
validators must succeed.
117
page The JavaBean corresponding to this form may include
118
a page property. Only fields with a "page" attribute
119
value that is equal to or less than the page property
120
on the form JavaBean are processed. This is useful when
121
using a "wizard" approach to completing a large form,
122
to ensure that a page is not skipped.
126
The "indexedListProperty" is the method name that will
127
return an array or a Collection used to retrieve the
128
list and then loop through the list performing the
129
validations for this field.
132
<!ELEMENT field (msg|arg|var)*>
133
<!ATTLIST field property CDATA #REQUIRED>
134
<!ATTLIST field depends CDATA #IMPLIED>
135
<!ATTLIST field page CDATA #IMPLIED>
136
<!ATTLIST field indexedListProperty CDATA #IMPLIED>
140
Defines a custom message key to use when one of the
141
validators for this field fails. Each validator has a default message
142
property that is used when a corresponding field msg is not specified.
143
Each validator applied to a field may have its own msg element.
144
The msg element accepts these attributes.
146
name The name of the validator corresponding to this msg.
148
bundle The resource bundle name that the key should be resolved in.
150
key The key that will return the message template from a
153
resource If set to "false", the key is taken to be a literal
154
value rather than a bundle key.
158
<!ATTLIST msg key CDATA #REQUIRED>
159
<!ATTLIST msg name CDATA #REQUIRED>
160
<!ATTLIST msg bundle CDATA #IMPLIED>
161
<!ATTLIST msg resource CDATA #IMPLIED>
166
Defines a replacement value to use with the
167
message template for this validator or this field.
168
The arg element accepts these attributes.
170
name The name of the validator corresponding to this msg.
171
If not supplied, this argument will be used in the given
172
position for every validator.
174
bundle The resource bundle name that the key should be resolved in.
176
key The key that will return the message template from a
179
resource If set to "false", the key is taken to be a literal
180
value rather than a bundle key.
183
position The position of this replacement parameter in the message.
184
For example, position="0" will set the first argument.
186
N.B. Since 1.2.0 position is ignored for 'default' arguments
187
(i.e. those with no 'name' supplied) - it is calculated
188
automatically from the order the arguments are added in.
189
For 'overriden' arguments (i.e. those with a 'name')
190
it is optional. If 'position' is not supplied it will
191
use the position of the 'default' argument it follows.
194
<!ATTLIST arg key CDATA #REQUIRED>
195
<!ATTLIST arg bundle CDATA #IMPLIED>
196
<!ATTLIST arg name CDATA #IMPLIED>
197
<!ATTLIST arg resource CDATA #IMPLIED>
198
<!ATTLIST arg position CDATA #IMPLIED>
201
The "var" element can set parameters that a field may need to pass to
202
one of its validators, such as the minimum and maximum values in a
203
range validation. These parameters may also be referenced by one of the
204
arg? elements using a shell syntax: ${var:var-name}.
206
<!ELEMENT var (var-name, var-value, var-jstype?)>
211
The name of the var parameter to provide to a field's validators.
213
<!ELEMENT var-name (#PCDATA)>
218
The value of the var parameter to provide to a field's validators.
220
<!ELEMENT var-value (#PCDATA)>
223
The javascript type. Possible Values [int|string|regexp]
225
<!ELEMENT var-jstype (#PCDATA)>