IPWorks X12 2020 JavaScript Edition

Questions / Feedback?

Validate Method

Validates the specified EDI document.


async x12validator.validate(): Promise<void>


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";


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

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks X12 2020 JavaScript Edition - Version 20.0 [Build 8262]