Automatically Convert EDI to XML

Electronic Data Interchange (EDI) has proven to be a durable business-to-business communication technology in use today with history dating to the 1960s and even earlier. Efficient EDI data encoding reduced transaction payload size and improved data transfer speeds at a time when messages were sent over teletype at speeds equivalent to a 300 baud modem. EDI standards bodies promote wide acceptance among enterprises, and systematic evolution of new EDI formats extends support across industries. EDI improves profitability and is a dominant format for e-commerce data exchange.

But EDI files are barely human readable and need to be translated and mapped for compatibility with other business technologies. Altova MapForce is a graphical EDI mapping tool with native support for all major business data formats in use today, including XML, JSON, databases, flat files, Excel, and Web services, as well as the EDIFACT, X12, HL7, NCPDP SCRIPT, IDoc, PADIS, and SWIFT EDI transaction sets. MapForce can even automatically convert EDI to XML without the need to specify a target XML Schema or perform any manual mapping.

To automatically convert EDI to XML in MapForce, start by dropping any EDI collection into a new mapping. We’ll use a sample IATA EDI source file included with the MapForce examples. The Browse EDI collections dialog supports all major EDI standards:

The Browse EDI collections dialog supports all major EDI standards

We selected the Flight Information Response message from the IATA collection. If you have a source EDI document for mapping but don’t know in advance exactly which message to choose, you can simply open the file in any text editor and see the message type near the top of the file. Here’s a view of our source:

Text editor view of the EDI source file,

We assign the IATA.edi file as our source document and the EDI message appears in the main mapping pane:

The source EDI file ready for mapping

Then we right-click the header and choose Create Mapping to XML from the context menu:

Context menu option to automatically convert EDI to XML

That’s it! That’s all it takes to create a quick EDI to XML mapping:

Complete mapping to automatically convert EDI to XML

To execute the mapping we simply click the Output button at the bottom of the mapping pane, which opens the Output preview window:

XML output after conversion

The output is an XML document where each EDI message segment is encoded inside XML elements that match the EDI segment names.

Optional message segments that don’t appear in the input are represented as empty XML elements, as seen in line 13 above for message segment S009.

Once the EDI source document is transformed to XML, you have many options to integrate with any specific EDI workflow requirement. You can save the mapping as a MapForce Server Execution file or upload it to a FlowForce Server for automated processing. You can enhance the mapping to create a chained mapping for further transformation. The XML output can be processed in a separate mapping, or an XSL transformation can be applied.

MapForce supports the most recent versions of most EDI collections by default. If you need to work with EDI messages based on earlier standards, MapForce provides a quick link to download earlier versions of ANSI X12, HIPAA-X12, HL7, PADIS, NCPDP, and SWIFT configuration files:

Support for older versions of EDI standards

The technique illustrated above to automatically convert EDI to XML works with all EDI collections supported by MapForce.

To quickly convert EDI to XML for yourself, download a free trial including Tutorials, Help, and many more examples!

NOTE: If you’re interested in reading more about the history of EDI to learn why EDI persists while technologies like computer punch cards and floppy disk drives have faded to obscurity, check out this article that originally appeared in Computerworld magazine.

Tags: , , ,