Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to convert XML to X12 and X12 to XML

Tags:

Looking for a tool/library to convert XML to X12 (270 - medical eligibility request) and then to convert the X12 response (271 - eligibility response) back to XML. This will be embedded in a server application (will consider any target language). I've toyed with idea of writing my own X12 parser and generator but this project will most likely expand to other X12 transactions and I'd like to find a solution that will be extensible.

like image 482
jdigital Avatar asked Jan 16 '09 02:01

jdigital


People also ask

How do I convert EDI format?

Convert the EDI Document from X12 to XML To translate documents manually, navigate to the Flows tab and click the X12_IN Connector in the workspace, then click the Input tab, select the document to translate, and click the Send button to process the file.

What is X12 Parser?

Java library for parsing and creating ASC X12 EDI transactions. ASC X12 standards define one of the widely used EDI formats. This library enables easy parsing and creation of X12 transactions. Parse X12 transactions (With Loop identification introduced with version 0.7).


2 Answers

I came across this: OopFactory X12 Parser - https://x12parser.codeplex.com/releases/view/106524

Incredible. Source code was well structured, everything built on first open, even had unit tests.

Pulled into my project, it converted all the files I tried.

It includes a command line exe which worked - but as a .Net guy the library was really impressive.

-Update-

The short short version comes down to something like this:

var fstream = new FileStream(fileName, FileMode.Open, FileAccess.Read); var parser = new X12Parser(); var interchange = parser.ParseMultiple(fstream).First(); var x12Xml = interchange.Serialize(); 
like image 178
JonK Avatar answered Oct 16 '22 19:10

JonK


I ended up creating my own XML <-> x12 transformation tool. There were some commercial offerings that I came across (one of which, from EtaSoft, is worth checking out for their fine documentation) but ultimately the advantage of a homegrown solution was too great.

I did use the configuration files from X12::Parser as the basis for an X12 parser, essentially turning the config file into code and eliminating the overhead and error handling for managing configuration files that should in theory almost never change.

like image 21
jdigital Avatar answered Oct 16 '22 19:10

jdigital