[opencms-dev] Localization of xmlcontent validation errors

Olaitan Olamilehin olaitan.olamilehin at moremr.com
Tue Feb 9 10:19:06 CET 2010


Hi Everyone,

Am trying to localize errors generated from validating unique field
values. Basically, I am using <xsd:unique> for the validation not
<validationrules>. 

        <xsd:element name="items" type="Items">
          <xsd:unique name="productName">
            <xsd:selector xpath="item"/>
            <xsd:field    xpath="ProductName"/>
          </xsd:unique>
        </xsd:element>

I know <validationrules> allows you to set appropriate localized
messages but the validation is based on regular expressions.  See
example below:

        <validationrules>
           <rule element="Title" regex="!.*[Ee]rror.*" message="${key.editor.errormessage.Article.mustnotcontainerror|${validation.path}}" />
        </validationrules>
        
However, in my case am not validating the field value but the occurrence
of the field value (i.e that the field value is unique). The validation
works just fine using <xsd:unique> but I would like to localize the xsd
errors that is shown. Currently, the xsd error is not user-friendly. See
below:

        XML validation error : 
        <errors>
        <error column="46" line="27">cvc-identity-constraint.4.1: Duplicate unique value [test] declared for identity constraint "productName" of element "items".</error>
        </errors>

Any help would be much appreciated. Thanks in anticipation of a quick
response.

Regards,
Olaitan.




More information about the opencms-dev mailing list