Best way to convert XML to X12 and X12 to XML

jdigital picture jdigital · Jan 16, 2009 · Viewed 27.2k times · Source

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.

Answer

JonK picture JonK · Jul 18, 2013

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();