The Validator framework is designed to enable you to specify validations declaratively in external configuration files instead of having to hard-code validation logic into the application. This simplifies development because validations can be changed, added, or removed as necessary without having to recompile any code. Using configuration files also enables a significant amount of code reuse for the validation routines.
The Validator configuration files are XML-based and their formats are governed by a Document Type Definition (DTD) file that specifies how the configuration tags must be ordered in each file, what settings are required, and so on. Each Validator configuration file declares its conformance to the DTD by having the following DOCTYPE definition at the top of the file:
<!DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.3.0//EN" "http://jakarta.apache.org/commons/dtds/validator_1_3_0.dtd">
When Validator reads the configuration file, its XML parser uses the DOCTYPE definition to determine the DTD that the XML file must conform to. If configured to do so, the XML parser will validate the XML file's conformance to the DTD.
An in-depth discussion of using the Validator framework is found in Chapter 6.