When I try to read an X12 204 using EDI Fabric, I get "Invalid Node Name: ST", but the file is well formed. Any idea why?

380 Views Asked by At

Here's an example 204 I have made. It validates with a couple different validation tools (EDI Notepad and Altova), but when I try to use EDI fabric to parse it, it gets the ISA and GS data just fine, but then errors out with "Invalid Node Name: ST".

I can't figure out why, any ideas?

ISA*ZZ*          *ZZ*          *ZZ*XXXX           *ZZ*YYYY           *170130*1025*U*00401*485789958*0*P*~
GS*SM*YYYY*XXXX*20170130*1027*485790079*X*004010
ST*204*485790093
B2**YYYY**123456789**CC
B2A*00
L11*123456789*CR
S5*1*LD
G62*64*20160131*1*1351
SE*7*485790093
GE*1*485790079
IEA*1*485789958

Here is the code:

internal static void Parse204(FileStream file, 
List<MyCompany.TruckRouteInfo> result)
        {
            var reader = EdiFabric.Framework.Readers.X12Reader.Create(file);
            file.Flush();

            var qEdiItems = reader.ReadToEnd();

            var ediItems = qEdiItems.ToList();

            var m204 = ediItems.OfType<M_204>().ToList();

            foreach (var item in m204)
            {
                MyCompany.TruckRouteInfo stop = new MyCompany.TruckRouteInfo ();

                foreach (var l11 in item.S_L11)
                {
                    if (l11.D_128_2 == EdiFabric.Rules.X12004010204.X12_ID_128.CR)
                    {
                        stop.Reference1 = l11.D_127_1;
                    }
                }
                result.Add(stop);
            }
        }
1

There are 1 best solutions below

1
Don Zoeggerle On

I've just literally copied your example and pasted it to a file which was processed fine. Works on my machine :) My best guess would be to open the file and inspect the line terminators for any discrepancies, which might have been sorted when I copied it\pasted it.