Support & Downloads

Optimize financial planning, tax reporting and inventory management with MME
accounting software integration.

One Liberty Plaza, 165 Broadway,
23rd Floor, NY 10006
info@webbeeglobal.com
+1 423 896 1025
Follow Us
 . edi  . How to convert EDI to XML
Convert EDI to XML

How to convert EDI to XML

What is XML?

Extensible Markup Language (XML) is a markup language based on texts which is derived from SGML (Standard Generalized Markup Language). These tags are used for identifying the data and are basically used to organize and store information and data.

What is the need of converting EDI to XML?

If we are able to convert EDI X12 to XML language, then it gives us an extra benefit over other developers who are involved in the EDI projects. This will eventually help the IT department to leverage the EDI2XML in their integrated EDI projects.

How to convert X12 EDI into XML language?

Before getting into conversion you need to understand raw EDI data.

For a sample, let us use this EDI 831 transaction file from X12 transaction set. We include this file (named 831.x12) in the “Convert to XML” folder.

ISA:00:          :00:          :01:1515151515     :01:515151

5151     :041201:1217:U:00403:000032123:0:P:*~GS:CT:99887766

55:1122334455:20041201:1217:128:X:004030~ST:831:00128001~BGN

:00:88200001:20041201~N9:BT:88200001~TRN:1:88200001~AMT:2:10

0000.00~QTY:46:1~SE:7:00128001~GE:1:128~IEA:1:000032123~

This below example will tell you how an EDI file can be converted into a XML file. The source code in the VB.NET which is used for converting EDI files into a XML file which is built with the function of EDIdEv framework EDI (FREDI). So how to convert EDI into XML? The basic and simple algorithm to convert is

  • Instantiate an Electronic Data Interchange (EDI) document (it should be in the form of FREDI component)
  • Load on the appropriate and suitable SEF file, that is essentially a scheme of any transaction set. This is because the FREDI do know how to have parsed an EDI file correctly and correspondingly.

<?xml version=”1.0″ encoding=”utf-8″?>

<wsedi xmlns=“http://www.wsedi.org/ns/edi/4.1/”>

    <segment>

        <code>ISA</code>

        <element>00</element>

        <element>00</element>

        <element>01</element>

        <element>1515151515</element>

…. And so on. This is the code behind this logic.

  • Load the EDI file which is to be converted into an EDI document object.
  • This EDI document should be saved as an XML output.

         “Private Sub cmdConvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConvert.Click

            ‘Recommended only for short EDI files

            Dim oEdiDoc As ediDocument

            Dim spath As String

            cmdConvert.Enabled = False

            Me.Cursor = Cursors.WaitCursor

            spath = AppDomain.CurrentDomain.BaseDirectory

 oEdiDoc.Set(oEdiDoc, New ediDocument)   ‘instantiate EDI document ‘oEdiDoc = New ediDocument

            ‘Load Schema for transaction set 850 4010

oEdiDoc.LoadSchema(spath & “850_X12-4010.SEF”, SchemaTypeIDConstants.Schema_Standard_Exchange_Format)

            ‘Load 850 4010 EDI File

            oEdiDoc.LoadEdi(spath & “850.X12”)

            ‘Save to XML format

            oEdiDoc.Save(spath & “850_X12_XmlOutput.XML”, OutputTypeIDConstants.OutputType_XML)

            ‘Display XML string on screen

            MsgBox(oEdiDoc.GetEdiString(OutputTypeIDConstants.OutputType_XML))

            Me.Cursor = Cursors.Default

            MsgBox(“Done. XML file =  ” & sXmlFile)

            oEdiDoc.Dispose()   ‘oEdiDoc = Nothing

        End Sub

                       “After using this code the suitable output of XML comes out. The partial XML File output is given below:

Converting EDI to XML

If you are looking for the best EDI Consulting Company then, you can visit our websites and we can convert EDI to XML for you.

Read More: