XML Validator

Overview

This Snap validates XML documents against an XSD (XML Schema Definition) schema and outputs the validation results.

Use this Snap to ensure XML data conforms to a specified schema before processing. The Snap validates structure, data types, and constraints defined in the XSD schema.


XML Validator Snap dialog

Snap views

Type Description Examples of upstream and downstream Snaps
Input

This Snap has at most one document binary input view. The input must contain:

  • XML-formatted data in binary or document form
  • UTF-8 encoded data (if non-UTF-8 encoded data is passed, it may result in errors

The XML data must be well-formed for the Snap to validate it against the schema.

Output

This Snap has at most one document output view. The output contains:

  • The original input document
  • Validation status (valid/invalid)
  • Validation errors (if any)

Valid documents are sent to the output view. Invalid documents are sent to the error view.

Learn more about Error handling.

Snap settings

Note: Learn about the common controls in the Snap settings dialog.
Field/Field set Description

Label

String
Required.Specify a unique name for the Snap. Modify this to be more appropriate, especially if there are more than one of the same Snap in the pipeline.

Default value: XML Validator

Example: Validate Purchase Order XML

Inbound Schema URL

String/Expression

Required. Specify the XSD schema definition file to use for validation.

Example: CustomersOrders_xml_gernerator_test.xsd

Snap execution
Choose one of the three modes in which the Snap executes. Available options are:
  • Validate & Execute: Performs limited execution of the Snap and generates a data preview during pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during pipeline runtime.
  • Execute only: Performs full execution of the Snap during pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Default value: Execute Only

Example: Validate and Execute

Troubleshooting

Error Reason Resolution
Schema validation failed: element not allowed The XML document contains elements not defined in the XSD schema. Review the XSD schema and ensure all elements in the XML document are properly defined. Check for typos in element names.
Data type mismatch The XML data type does not match the type defined in the schema. Verify that the data values conform to the types specified in the XSD schema (for example, integers, dates, strings).
Required element missing A required element defined in the schema is missing from the XML document. Add the missing required element to the XML document or update the schema to make the element optional.

Examples