IPWorks EDIFACT 2020 Python Edition

Questions / Feedback?

validate Method

Validates the specified EDI document.

Syntax

def validate() -> None: ...

Remarks

This method validates the EDI document specified by input_file or input_data.

Before calling on_validate set schema_format and call load_schema to load the schema for the document to be validated. The schema defines many validation rules such as minimum and maximum lengths, minimum and maximum occurrences, and more. The validation performed by the class depends largely on the schema's definition.

When the on_validate method is called the class will attempt to validate the document. If errors are found during validation the on_validation_error event will fire with details about each error as it is encountered. After the document has been validated the validation_errors property will be populated with details of each error.

Inspect the validation_errors property for information on any errors that were encountered.

Validation Example

validator.InputFile = "files/EDIDocuments/MyEDIDoc.txt";
validator.LoadSchema("my_schemas/00501/RSSBus_005010X222A1_837.json");

validator.Validate();

foreach (ValidationErrorDetail error in validator.ValidationErrors) {
  Console.WriteLine(error.ErrorCode + ": " + error.Message);
}

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks EDIFACT 2020 Python Edition - Version 20.0 [Build 8209]