2
DTD for the Validator Rules Configuration File, Version 1.1
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.1//EN"
10
"http://jakarta.apache.org/commons/dtds/validator_1_1.dtd">
12
Id: validator_1_1.dtd,v 1.5 2003/08/11 23:50:31 dgraham 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
The "validator" element defines what validator objects can be used with
34
the fields referenced by the formset elements.
36
<!ELEMENT validator (javascript?)>
37
<!ATTLIST validator name CDATA #REQUIRED>
38
<!ATTLIST validator classname CDATA #REQUIRED>
39
<!ATTLIST validator method CDATA #REQUIRED>
40
<!ATTLIST validator methodParams CDATA #REQUIRED>
41
<!ATTLIST validator msg CDATA #REQUIRED>
42
<!ATTLIST validator depends CDATA #IMPLIED>
43
<!ATTLIST validator jsFunctionName CDATA #IMPLIED>
44
<!ATTLIST validator jsFunction CDATA #IMPLIED>
48
The "javascript" element defines a JavaScript that can be used to perform
49
client-side validators.
51
<!ELEMENT javascript (#PCDATA)>
55
The "constant" element defines a static value that can be used as
56
replacement parameters within "field" elements. The "constant-name" and
57
"constant-value" elements define the constant's reference id and replacement
60
<!ELEMENT constant (constant-name, constant-value)>
61
<!ELEMENT constant-name (#PCDATA)>
62
<!ELEMENT constant-value (#PCDATA)>
66
The "formset" element defines a set of forms for a locale. Formsets for
67
specific locales can override only those fields that change. The
68
localization is properly scoped, so that a formset can override just the
69
language, or just the country, or both.
71
<!ELEMENT formset (constant*, form+)>
72
<!ATTLIST formset language CDATA #IMPLIED>
73
<!ATTLIST formset country CDATA #IMPLIED>
74
<!ATTLIST formset variant CDATA #IMPLIED>
78
The "form" element defines a set of fields to be validated. The name
79
corresponds to the identifer the application assigns to the form.
81
<!ELEMENT form (field+)>
82
<!ATTLIST form name CDATA #REQUIRED>
86
The "field" element defines the properties to be validated. In a
87
web application, a field would also correspond to a control on
88
a HTML form. To validate the properties, the validator works through
89
a JavaBean representation. The field element accepts these
92
property The property on the JavaBean corresponding to this
95
depends The comma-delimited list of validators to apply against
96
this field. For the field to succeed, all the
97
validators must succeed.
99
page The JavaBean corresponding to this form may include
100
a page property. Only fields with a "page" attribute
101
value that is equal to or less than the page property
102
on the form JavaBean are processed. This is useful when
103
using a "wizard" approach to completing a large form,
104
to ensure that a page is not skipped.
108
The "indexedListProperty" is the method name that will
109
return an array or a Collection used to retrieve the
110
list and then loop through the list performing the
111
validations for this field.
114
<!ELEMENT field (msg|arg|arg0|arg1|arg2|arg3|var)*>
115
<!ATTLIST field property CDATA #REQUIRED>
116
<!ATTLIST field depends CDATA #IMPLIED>
117
<!ATTLIST field page CDATA #IMPLIED>
118
<!ATTLIST field indexedListProperty CDATA #IMPLIED>
122
The "msg" element defines a custom message key to use when one of the
123
validators for this field fails. Each validator has a default message
124
property that is used when a corresonding field msg is not specified.
125
Each validator applied to a field may have its own msg element.
126
The msg element accepts these attributes.
128
name The name of the validator corresponding to this msg.
130
bundle The resource bundle name that the key should be resolved in.
132
key The key that will return the message template from a
135
resource If set to "false", the key is taken to be a literal
136
value rather than a bundle key.
140
<!ATTLIST msg key CDATA #REQUIRED>
141
<!ATTLIST msg name CDATA #REQUIRED>
142
<!ATTLIST msg bundle CDATA #IMPLIED>
143
<!ATTLIST msg resource CDATA #IMPLIED>
148
The "arg" element defines a replacement value to use with the
149
message template for this validator or this field.
150
The arg element accepts these attributes.
152
name The name of the validator corresponding to this msg.
153
If not supplied, this argument will be used in the given
154
position for every validator.
156
bundle The resource bundle name that the key should be resolved in.
158
key The key that will return the message template from a
161
resource If set to "false", the key is taken to be a literal
162
value rather than a bundle key.
165
position The position of this replacement parameter in the message.
166
For example, position="0" will set the first argument.
170
<!ATTLIST arg key CDATA #REQUIRED>
171
<!ATTLIST arg bundle CDATA #IMPLIED>
172
<!ATTLIST arg name CDATA #IMPLIED>
173
<!ATTLIST arg resource CDATA #IMPLIED>
174
<!ATTLIST arg position CDATA #IMPLIED>
180
DEPRECATED Use <arg position="0"/> instead.
182
The "arg0" element defines the first replacement value to use with the
183
message template for this validator or this field.
184
The arg0 element accepts these attributes.
186
name The name of the validator corresponding to this msg.
188
key The key that will return the message template from a
191
resource If set to "false", the key is taken to be a literal
192
value rather than a bundle key.
195
<!ELEMENT arg0 EMPTY>
196
<!ATTLIST arg0 name CDATA #IMPLIED>
197
<!ATTLIST arg0 key CDATA #IMPLIED>
198
<!ATTLIST arg0 resource CDATA #IMPLIED>
203
DEPRECATED Use <arg position="1"/> instead.
205
The "arg1" element defines the second replacement value to use with the
206
message template for this validator or this field.
207
The arg1 element accepts these attributes.
209
name The name of the validator corresponding to this msg.
211
key The key that will return the message template from a
214
resource If set to "false", the key is taken to be a literal
215
value rather than a bundle key.
218
<!ELEMENT arg1 EMPTY>
219
<!ATTLIST arg1 name CDATA #IMPLIED>
220
<!ATTLIST arg1 key CDATA #IMPLIED>
221
<!ATTLIST arg1 resource CDATA #IMPLIED>
226
DEPRECATED Use <arg position="2"/> instead.
228
The "arg2" element defines the third replacement value to use with the
229
message template for this validator or this field.
230
The arg2 element accepts these attributes.
232
name The name of the validator corresponding to this msg.
234
key The key that will return the message template from a
237
resource If set to "false", the key is taken to be a literal
238
value rather than a bundle key.
241
<!ELEMENT arg2 EMPTY>
242
<!ATTLIST arg2 name CDATA #IMPLIED>
243
<!ATTLIST arg2 key CDATA #IMPLIED>
244
<!ATTLIST arg2 resource CDATA #IMPLIED>
249
DEPRECATED Use <arg position="3"/> instead.
251
The "arg3" element defines the fourth replacement value to use with the
252
message template for this validator or this field.
253
The arg0 element accepts these attributes.
255
name The name of the validator corresponding to this msg.
257
key The key that will return the message template from a
260
resource If set to "false", the key is taken to be a literal
261
value rather than a bundle key.
264
<!ELEMENT arg3 EMPTY>
265
<!ATTLIST arg3 name CDATA #IMPLIED>
266
<!ATTLIST arg3 key CDATA #IMPLIED>
267
<!ATTLIST arg3 resource CDATA #IMPLIED>
271
The "var" element can set parameters that a field may need to pass to
272
one of its validators, such as the minimum and maximum values in a
273
range validation. These parameters may also be referenced by one of the
274
arg? elements using a shell syntax: ${var:var-name}.
276
<!ELEMENT var (var-name, var-value)>
281
The name of the var parameter to provide to a field's validators.
283
<!ELEMENT var-name (#PCDATA)>
288
The value of the var parameter to provide to a field's validators.
290
<!ELEMENT var-value (#PCDATA)>