Source

xwork / test / com / opensymphony / xwork / validator / validator-parser-test.xml

<!DOCTYPE validators PUBLIC
        "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
        "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
    <field name="foo">
        <field-validator type="required">
            <message key="test.key">You must enter a value for foo.</message>
        </field-validator>
    </field>
    <field name="bar">
        <field-validator type="required" short-circuit="true">
            <message key="bar.key">You must enter a value for bar.</message>
        </field-validator>
        <field-validator type="int">
            <param name="min">6</param>
            <param name="max">10</param>
            <message>bar must be between ${min} and ${max}, current value is ${bar}.</message>
        </field-validator>
        <field-validator type="regex">
            <param name="expression">
                <!-- Some useless comment for the following expression, which should be ignored by parser -->
                <![CDATA[([aAbBcCdD][123][eEfFgG][456])]]>
            </param>
            <message>bar must must match the given expression.</message>
        </field-validator>
    </field>
    <validator type="expression">
        <param name="expression">email.equals(email2)</param>
        <message>Email not the same as email2</message>
    </validator>
    <validator type="expression" short-circuit="true">
        <param name="expression">email.startsWith('mark')</param>
        <message>Email does not start with mark</message>
    </validator>
</validators>