-Electronic Data Interchange (EDI) is an electronic version of data transactions.
-Extensible Markup Language (XML) is a markup language based on texts which are derived from SGML (Standard Generalized Markup Language).
-These tags are used for identifying the data and are used to organize and store information and data.
-The source code in the VB.NET is used for converting EDI files into an XML file.
What is Electronic Data Interchange (EDI)?
Electronic Data Interchange (EDI) is an electronic version of data transactions between two organizations, companies, or trading partners. Data information like bills, invoices, shipping details, order graphs, payments, etc. are done electronically in EDI
What is XML?
Extensible Markup Language (XML) is a markup language based on texts which are derived from SGML (Standard Generalized Markup Language). These tags are used for identifying the data and are used to organize and store information and data.
What is the need of converting EDI to XML?
If we can 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 the 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~
The below example will tell you how an EDI file can be converted into an XML file. The source code in the VB.NET is used for converting EDI files into an 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
1) Instantiate an Electronic Data Interchange (EDI) document (it should be in the form of a FREDI component)
2) Load on the appropriate and suitable SEF file, which 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.
3) Load the EDI file which is to be converted into an EDI document object.
4) 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
“
A platform for all the enthusiast individuals to express their opinion with guidance of the experts, reach out if you too want to grow with us.
After using this code the suitable output of XML comes out. The partial XML File output is given below;