IPWorks EDIFACT 2020 Qt Edition

Questions / Feedback?

Validate Method

Validates the specified EDI document.


int Validate();


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

Error Handling

This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)

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