2
DTD for the Validator Rules Configuration File, Version 1.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.0//EN"
10
"http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">
12
$Id: validator_1_0.dtd,v 1.4 2002/10/23 01:32:01 turner Exp $
16
<!-- =================================================== Top Level Elements -->
20
The "form-validation" element is the root of the configuration file
21
hierarchy, and contains nested elements for all of the other
22
configuration settings.
24
<!ELEMENT form-validation (global*, formset*)>
28
The elements defined here are all global and must be nested within a
31
<!ELEMENT global (validator*, constant*)>
35
The "validator" element defines what validators objects can be used with
36
the fields referenced by the formset elements. The validator element can
37
accept 4 properties: name, classname, method, methodparams, msg, depends,
40
<!ELEMENT validator (javascript?)>
41
<!ATTLIST validator name CDATA #REQUIRED
42
classname CDATA #REQUIRED
43
method CDATA #REQUIRED
44
methodParams CDATA #REQUIRED
46
depends CDATA #IMPLIED
47
jsFunctionName CDATA #IMPLIED >
51
The "javascript" element defines a JavaScript that can be used to perform
52
client-side validators.
54
<!ELEMENT javascript (#PCDATA)>
58
The "constant" element defines a static value that can be used as
59
replacement parameters within "field" elements. The "constant-name" and
60
"constant-value" elements define the constant's reference id and replacement
63
<!ELEMENT constant (constant-name, constant-value)>
64
<!ELEMENT constant-name (#PCDATA)>
65
<!ELEMENT constant-value (#PCDATA)>
69
The "formset" element defines a set of forms for a locale. Formsets for
70
specific locales can override only those fields that change. The
71
localization is properly scoped, so that a formset can override just the
72
language, or just the country, or both.
74
<!ELEMENT formset (constant*, form+)>
75
<!ATTLIST formset language CDATA #IMPLIED
76
country CDATA #IMPLIED >
80
The "form" element defines a set of fields to be validated. The name
81
corresponds to the identifer the application assigns to the form.
83
<!ELEMENT form (field+ )>
84
<!ATTLIST form name CDATA #REQUIRED>
88
The "field" element defines the properties to be validated. In a
89
web application, a field would also correspond to a control on
90
a HTML form. To validate the properties, the validator works through
91
a JavaBean representation. The field element can accept up to 4
94
property The property on the JavaBean corresponding to this
97
depends The comma-delimited list of validators to apply against
98
this field. For the field to succeed, all the
99
validators must succeed.
101
page The JavaBean corresponding to this form may include
102
a page property. Only fields with a "page" attribute
103
value that is equal to or less than the page property
104
on the form JavaBean are processed. This is useful when
105
using a "wizard" approach to completing a large form,
106
to ensure that a page is not skipped.
110
The "indexedListProperty" is the method name that will
111
return an array or a Collection used to retrieve the
112
list and then loop through the list performing the
113
validations for this field.
116
<!ELEMENT field (msg|arg0|arg1|arg2|arg3|var)*>
117
<!ATTLIST field property CDATA #REQUIRED
118
depends CDATA #IMPLIED
120
indexedListProperty CDATA #IMPLIED >
124
The "msg" element defines a custom message key to use when one of the
125
validators for this field fails. Each validator has a default message
126
property that is used when a corresonding field msg is not specified.
127
Each validator applied to a field may have its own msg element.
128
The msg element accepts up to three attributes.
130
name The name of the validator corresponding to this msg.
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 name CDATA #IMPLIED
142
resource CDATA #IMPLIED >
146
The "arg0" element defines the first replacement value to use with the
147
message template for this validator or this field.
148
The arg0 element accepts up to three attributes.
150
name The name of the validator corresponding to this msg.
152
key The key that will return the message template from a
155
resource If set to "false", the key is taken to be a literal
156
value rather than a bundle key.
159
<!ELEMENT arg0 EMPTY>
160
<!ATTLIST arg0 name CDATA #IMPLIED
162
resource CDATA #IMPLIED >
166
The "arg1" element defines the second replacement value to use with the
167
message template for this validator or this field.
168
The arg1 element accepts up to three attributes.
170
name The name of the validator corresponding to this msg.
172
key The key that will return the message template from a
175
resource If set to "false", the key is taken to be a literal
176
value rather than a bundle key.
179
<!ELEMENT arg1 EMPTY>
180
<!ATTLIST arg1 name CDATA #IMPLIED
182
resource CDATA #IMPLIED >
186
The "arg2" element defines the third replacement value to use with the
187
message template for this validator or this field.
188
The arg2 element accepts up to three attributes.
190
name The name of the validator corresponding to this msg.
192
key The key that will return the message template from a
195
resource If set to "false", the key is taken to be a literal
196
value rather than a bundle key.
199
<!ELEMENT arg2 EMPTY>
200
<!ATTLIST arg2 name CDATA #IMPLIED
202
resource CDATA #IMPLIED >
205
The "arg3" element defines the fourth replacement value to use with the
206
message template for this validator or this field.
207
The arg0 element accepts up to three 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 arg3 EMPTY>
219
<!ATTLIST arg3 name CDATA #IMPLIED
221
resource CDATA #IMPLIED >
225
The "var" element can set parameters that a field may need to pass to
226
one of its validators, such as the minimum and maximum values in a
227
range validation. These parameters may also be referenced by one of the
228
arg? elements using a shell syntax: ${var:var-name}.
230
<!ELEMENT var (var-name, var-value)>
235
The name of the var parameter to provide to a field's validators.
237
<!ELEMENT var-name (#PCDATA)>
242
The value of the var parameter to provide to a field's validators.
244
<!ELEMENT var-value (#PCDATA)>