Examples

Short Example

A short example of a validation XML file looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<validation xmlns="http://simpval.sourceforge.net/Schema">
<rules>
<ruleset name="notempty">
<rule>
<expression>\w+</expression>
</rule>
</ruleset>
</rules>
<validationtargets>
<validationtarget name="Person">
<field name="FirstName" ruleset="notempty">Please enter your first name</field>
<field name="LastName" ruleset="notempty">Please enter your last name</field>
</validationtarget>
</validationtargets>
</validation>

To perform the validation is as easy as:

Dictionary<string, string> errors = Validator.Instance.Validate("Validation_Name", class_to_validate);

This will return a list of which fields failed validaton with an error message for each.

More detailed examples will come soon.