Defining validation rules in datatypes XML file

You can register a validation rule using the datatypes.xml file.

This method of registering a validation rule can only be used for parameter value inputs. The datatype for a parameter is deduced using the datatypes map. And the parameter value is validated using the validation rules registered against that datatype.

Applications based on the HTML UI Framework can register a regular expression based or java based validation rule in the datatypes.xml file in the following way:
<DataType Name="Address" Size="70" Type="NVARCHAR">
   <UIType Size="30" UITableSize="30"/>
        <Regex JavaPattern="<pattern>" JSPattern="<pattern>" allowNull="false"/>
        <Impl JavaClass="com.sterlingcommerce.test.MyRuleClass" 
By default, for a <Regex> element, the maximum size of the validation rule is set to the size of the datatype. You can override the maximum size of the validation rule using the MaxLength attribute. Also, you can set the minimum size of the validation rule using the MinLength attribute. Similarly, you can override other attributes such as JSPattern, JavaPattern, and AllowNull. For example,
<DataType Size="5" Name="Pincode" Type="NUMBER">
     <Regex MaxLength="200" MinLength="3" JavaPattern="^[a-zA-Z0-9.,!\-/+=:]*$"              JSPattern="^[a-zA-Z0-9.,!\-/+=_ :]*$" allowNull="true"/>
Note: Java™ based validation rule class must have a fully qualified class name. And this class must implement the ISCValidationRule interface.
Note: In the datatypes.xml file, you can also define javascript patterns and functions to validate the input on the client itself. These client side validations will be fetched on the client and all the corresponding inputs will be validated against these client side validations.