EDI File Loader

Parse Any EDI Document Without Writing A Parser

EDIFileLoader provides a fast and easy way to parse and load any EDI document.

Main Features

  • No need to write your own EDI parser
  • Loads any ANSI X12 document
  • Easily loop through each segment to access segment and element values
  • Loads EDI documents from the file system or in-memory strings
  • Exposes an array containing all lines of the loaded EDI document
  • Creates an EDIDocument object after loading for easy access to EDI data
  • Ability to convert EDI documents to XML

Details

Loading from a File or In-Memory String

EDIFileLoader can load EDI documents from the file system using the EDIFile property or from a string using the EDIDataString property.

Accessing Parsed and Loaded Data

Accessing EDI data is easy.  Because EDIFileLoader does not use any validation rules, there is no validation performed on the data.  More importantly there is no proper hierarchy data conforming to the implementation guides as you would find in the EDIValidator component.  There is only one main loop containing all the parsed segments and elements that exist in the document.  This gives developers the flexibility to consume this data however they please.

EDIFileLoaderEDIFileLoader_EDIFACT

Grouping of EDI Envelopes

EDIFileLoader will create a different parent loop for each Interchange it encounters

loaderFlatStructure3

Accessing Raw EDI Data

EDIFileLoader allows you to retrieve the raw EDI data after validation.  The raw EDI data is placed in an array.  Each index represents one line from the EDI document.  EDIFileLoader has this data available through the EDIFileLines property.

Auto Detection of Delimiters

EDIFileLoader has a Delimiter property that can be set if the delimiters are known beforehand.  It also has a property called AutoDetectDelimiters.  By enabling this property EDIFileLoader detects the special delimiter characters while loading is being performed.

Convert to XML

EDI data can be converted to XML after loading

The Code

// Create a new instance of EDIFileLoader
EDIFileLoader loader = new EDIFileLoader();

loader.AutoDetectDelimiters = true;

// Set the type of EDI file that you are about the load
loader.EDIFileType = FileType.X12;

// Set the source of EDI data, whether you are loading from an in-memory string or a file
loader.EDISource = EDISource.File; // Or EDISource.DataString

// Set the EDI file path to load
loader.EDIFile = "C:\\EDIFile.txt;

// load the data
EDILightWeightDocument loadedDocument = loader.Load();