Validate XML against XSD

Validate XML against XSD

This advanced validation workflow component, Validate XML against XSD, can validate XML according to rules.

This component can validate an XML file against an schema definition (XSD). This component takes XML as input.

The component throws an exception if the validation fails. This exception can e.g. trigger an error workflow.

 

The component has this parameter:

 

The XSD to validate against is selected as an attribute. The XSD can loaded in the "transform" folder in the library. An XSD file in the library is allowed to include other XSD files that are also in the library, using relative paths (just like in a normal file system).

 

A sample XSD can e.g. be created from an XML file with this free online tool:

https://www.freeformatter.com/xsd-generator.html#ad-output

 

Here is an example of how the validation can be setup:

 

On the header of Read from file you can e.g. refer to an on error workflow or insert an error handler prior to the validation.

 

The validation itself refers to the uploaded xsd file in the library transform folder:


The subtree to the right of the validation will only be executed, if the validation does not fail.

    • Related Articles

    • XML

      XML is used widely in InterFormNG2 as both input and output payload in the workflow (and of course in the designer). Please notice, that some workflow components are listed as accepting only XML as input, where they actually also accept an IBM i ...
    • Node Existence & Conditions

      XPath allows you to verify the existence of nodes, check if they contain data, count occurrences, and ignore namespaces. This section covers essential techniques for validating and filtering XML elements. Calculating the sum of nodes Counting ...
    • Validation rules library

      If you want to validate input XML files, then you can either validate with an XSD or via a rule based (schematron) validation. If you want to use a rule based validation, then you first need to upload a schematron file (.sch) in the Validation rules ...
    • Advanced Validation workflow components

      This is the list of advanced validation document workflow components: Rule-based validation report to log. Rule-based validation report to text attachment. Rule-based validation report to XML attachment. Rule-based XML validation. Validate XML ...
    • 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 ...