Rule based validation example

Rule based validation example

If you want to do a schematron validation, then you first need to insert the Rule based XML validation component:

 

NG2Schematron0002

 

A simple schemation validation file could be this:

 

<schema xmlns="http://purl.oclc.org/dsdl/schematron">

    <pattern name="Print both cases">

         <rule context="/Root/Document/DocumentNo">

         <report test="floor(.) = number(.)">O.K.</report>

              <assert test="floor(.) = number(.)">A Document number is not an integer.</assert>

         </rule>

    </pattern>

</schema>

 

This reports the error: A Document number is not an integer, if any of the nodes with the path: /Root/Document/DocumentNo is not an integer.

This schematron file is loaded into the Library into validationRule.

 

The subtree can e.g. contain this to report the result into the system log with the Rule based valiedation report to log component, and copy the validated XML file to the file system as the name: valid.xml or invalid.xml depending on the result of the validation:

 

NG2Schematron0003

    • Related Articles

    • Rule-based XML validation

      This advanced validation workflow component, Rule-based XML validation, can validate XML according to rules. The rules for rule-based validation can be used to validate documents in XML format. A suggestion for implementation can be found here. The ...
    • Rule-based validation report to text attachment

      This advanced validation workflow component, Rule-based validation report to text attachment, can be executed after a rule-based XML validation. If called it will copy the validation report into a text attachment, which can be emailed. A suggestion ...
    • Rule-based validation report to log

      This advanced validation workflow component, Rule-based validation report to log, can be executed after a rule-based XML validation. If called it will copy the validation report into the system log. A suggestion for implementation can be found here. ...
    • Rule-based validation report to XML attachment

      This advanced validation workflow component, Rule-based validation report to XML attachment, can be executed after a rule-based XML validation. If called it will copy the validation report into an XML attachment, which can be emailed. This XML ...
    • Advanced Validation workflow components

      This is the list of advanced validation document workflow components: 1.Rule-based validation report to log. 2.Rule-based validation report to text attachment. 3.Rule-based validation report to XML attachment. 4.Rule-based XML validation. 5.Validate ...