This project is read-only.
Project Description
Simple easy to use EDI (X12 and EDIFACT) reading\writing library + XmlReader\XmlWriter implementations over EDI data.


EdiStreamReader - simple interface for reading EDI streams.
            using (EdiStreamReader rd = new EdiStreamReader(File.OpenRead(@"myedifile.edi")))
            {
                DataSegment seg = rd.ReadSegment();
                while (null != seg)
                {
                    //do something with the segment
                    seg = rd.ReadSegment();
                }
            }

EdiStreamWriter - write EDI stream
            using (EdiStreamWriter wr = new EdiStreamWriter(File.Create(@"myedifile.edi"), EdiReaderWriterSettings.DefaultX12))
            {
                DataSegment segIsa = new DataSegment("ISA");
                segIsa[5][0] = "ZZ";
                segIsa[6][0] = "SENDER";
                // ....
                DataSegment.FormatIsaSegment(segIsa);
                wr.WriteSegment(segIsa);
                //create more segments
            }

EdiXmlReader - XmlReader implementation over EdiData. Produces XML like
<EdiXml>
  <ISA>
    <E1>00</E1>
    <E2>          </E2>
    <!-- ... -->
  </ISA>
  <BIG>
    <E1>20110825</E1>
    <E2>1111</E2>
    <E3>20110722</E3>
    <E4>PO123</E4>
  </BIG>
  <N1>
    <E1>BT</E1>
    <E2>BILLTO</E2>
    <E3>92</E3>
    <E4>123</E4>
  </N1>
  <!-- ... -->
</EdiXml>

EdiXmlReader class does not use maps\schemas and can only produce plain XML structure, no nested XML structures for loops, etc...

EdiXmlWriter - basic XmlWriter implementation. Writes XML directly to EDI file. Now you can use XSLT to transform EDI to EDI, also you can create XML documents and serialize them to EDI. Structure of the XML data must be the same as produced by EdiXmlReader (see XML example above).
Usage idea:
            EdiXmlReader ediXmlReader = new EdiXmlReader(...);
            EdiXmlWriter ediXmlWriter = new EdiXmlWriter(...);

            XslCompiledTransform transform = new XslCompiledTransform();
            transform.Load(...);

            transform.Transform(ediXmlReader, ediXmlWriter);



EdiNet.Test uses xUnit NuGet package
See unit tests for more usage examples or ask questions here.

Last edited Sep 25, 2013 at 10:40 PM by burokio, version 5