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:

 

NG2WorkflowValidateAgainstXSD0001

 

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:

 

NG2XSD0001

 

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:

 

NG2XSD0002

 

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 ...
    • 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 ...
    • JSON to XML

      One of the valid input formats of InterFormNG2 is JSON files. If you e.g. want to data in an input JSON file in either an email or in a template, then you first need to convert the JSON file into XML. You can use the basic, converter workflow ...
    • Log to XML

      This advanced utilities workflow component retrieves a job log and copies it into the payload (and overwrites the previous contents) of the current workflow in XML format. As default the component retrieves the job log of the current workflow. ...
    • Excel to XML component

      The advanced, converter workflow component, Excel to XML converts an input excel file in the .xlsx format into the special XML format. The converter handles rows, columns and the most important styles. A related workflow component can create an ...