X12Validator Class

Properties   Methods   Events   Configuration Settings   Errors  

X12Validator is a lightweight EDI validation class designed for simple document validation.

Syntax

IPWorksX12X12Validator
IPWorksX12X12ValidatorSwift

Remarks

This component provides a simple way to validate an EDI document and obtain details about any validation errors.

EDI Validation

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

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

- EDIStandardVersionThe version of the EDI specification.
- inputDataThe data to parse.
- inputFileThe file to parse.
- schemaFormatThe format of the schema file.
- validationErrorCountThe number of records in the ValidationError arrays.
- validationErrorColumn:(int)validationErrorIndexThe column number in the EDI document where the error occurred.
- validationErrorElementErrorCode:(int)validationErrorIndexThe error code which may be used in the IK403 property of a 999.
- validationErrorElementPosition:(int)validationErrorIndexThis property holds the position of the element where the error occurred.
- validationErrorErrorCode:(int)validationErrorIndexThe ErrorCode property contains the type of error encountered.
- validationErrorLine:(int)validationErrorIndexThe line number in the EDI document where the error occurred.
- validationErrorMessage:(int)validationErrorIndexMessage is a textual description of the error.
- validationErrorSegmentErrorCode:(int)validationErrorIndexThe error code which may be used in the IK304 property of a 999.
- validationErrorSegmentNumber:(int)validationErrorIndexThis property is the index of the segment where the error occurred.
- validationErrorSegmentTag:(int)validationErrorIndexThis property specifies the tag name of the segment where the error occurred.
- validationErrorTechnicalErrorCode:(int)validationErrorIndexThis property holds a technical error code that helps identify structural issues with the document.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

- compileSchemaCompiles an existing XSD schema into an optimized binary representation.
- configSets or retrieves a configuration setting.
- displaySchemaInfoReturns a string showing the structure of the schema defining the document.
- displayXMLInfoReturns a string showing the structure of the parsed document as XML.
- flushFlushes the parser and checks its end state.
- loadSchemaLoads a schema file describing a Transaction Set.
- resetResets the parser.
- validateValidates the specified EDI document.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

- onEndFunctionalGroupFires whenever a control segment is read that marks the end of an interchange.
- onEndInterchangeFires whenever a control segment is read that marks the end of an interchange.
- onEndLoopFires when the end of a loop is detected in a transaction set.
- onEndTransactionFires whenever a control segment is read that marks the end of a transaction.
- onErrorInformation about errors during data delivery.
- onResolveSchemaFires whenever a new transaction set is encountered and no schema is found for it.
- onSegmentFires whenever a data segment in a transaction set is read.
- onStartFunctionalGroupFires whenever a control segment is read that marks the start of a functional group.
- onStartInterchangeFires whenever a control segment is read that marks the start of an interchange.
- onStartLoopFires when the starting of a loop is detected in a transaction set.
- onStartTransactionFires whenever a control segment is read that marks the start of a transaction.
- onValidationErrorFires whenever a validation error is encountered.

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

ComponentDelimiterThe delimiter separating classes.
CrossFieldValidationEnabledEnables cross-field validation rules.
ElementDelimiterThe delimiter character separating data elements.
EncodingThe character encoding to be applied when reading and writing data.
ExtraDataExtra data that has not been parsed by the class.
HasXPathDetermines if the specified XPath exists.
ISA11IsRepetitionSeparatorSpecifies whether the ISA11 value is treated as a Repetition Separator or Standard Identifier.
MaxValidationErrorsThe maximum number of errors to save in the ValidationErrors property.
ReleaseCharThe character used to escape delimiters within values.
ResolveXPathOnSetDetermines whether or not the XPath is resolved when set.
SegmentDelimiterThe delimiter character separating segments within the EDI document.
StrictSchemaValidationSpecifies the behavior during schema validation.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

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