IPWorks EDI 2020 macOS Edition

Questions / Feedback?

Validate Method

Validates the specified EDI document.

Syntax

public func validate() throws -> Void

Remarks

This method validates the EDI document specified by InputFile or InputData.

Before calling Validate set SchemaFormat and call LoadSchema 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 Validate method is called the class will attempt to validate the document. If errors are found during validation the ValidationError event will fire with details about each error as it is encountered. After the document has been validated the ValidationErrors property will be populated with details of each error.

Inspect the ValidationErrors 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 EDI 2020 macOS Edition - Version 20.0 [Build 8203]