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
- Combine with EDIDocumentViewer to visually see and interact with all segments
- Ability to convert EDI document 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.
Grouping of EDI Envelopes
EDIFileLoader will create a different parent loop for each Interchange it encounters
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();
// Set the EDI file path to load
loader.EDIFile = "C:\\EDIFile.txt;
// Load the data
EDILightWeightDocument loadedDocument = loader.Load();
// Process all segments
foreach ( var segment in loadedDocument.Loops[0].Segments){ Console.WriteLine(segment.ToString());
}