IPWorks EDIFACT 2020 C++ Edition

Questions / Feedback?

Validate Method

Validates the specified EDI document.

Syntax

ANSI (Cross Platform)
int Validate();

Unicode (Windows)
INT Validate();
- (void)validate;
#define MID_EDIFACTVALIDATOR_VALIDATE 11

IPWORKSEDIFACT_EXTERNAL int IPWORKSEDIFACT_CALL IPWorksEDIFACT_EDIFACTValidator_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);

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

Error Handling (C++)

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 C++ Edition - Version 20.0 [Build 8209]