Index
Accessing Loaded EDI Data
Developers can access all data from an EDI file that has been loaded with the EDIFileLoader using the EDILightWeightDocument returned after calling the Load() method. The EDILightWeightDocumentreturned enables access the EDI file. Because EDIFileLoader does not use any rules file, there is no validation on the EDI data. More importantly there is no proper hierarchy data conforming to the EDI 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 EDI file. This gives developers the flexibility to group this data however they please.
Example
// Create a new instance of EDIFileLoader
EDIFileLoader loader = new EDIFileLoader();
EDIFileLoader loader = new EDIFileLoader();
// Set the EDI file to load
loader.EDIFile = “C:\\EDIFile.txt”;
// Load the file
EDILightWeightDocument doc = loader.Load();
// Get the main loop. This loop contains the entire EDI document
LightWeightLoop mainLoop = doc.Loop[0]; //the main loop
// Get all segments
Collection<LightWeightSegment> allSegments = mainLoop.Segments;
loader.EDIFile = “C:\\EDIFile.txt”;
// Load the file
EDILightWeightDocument doc = loader.Load();
// Get the main loop. This loop contains the entire EDI document
LightWeightLoop mainLoop = doc.Loop[0]; //the main loop
// Get all segments
Collection<LightWeightSegment> allSegments = mainLoop.Segments;