Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java XML to EDI design

I have a requirement to convert XML to EDI. I have searched a lot for open source free libraries which full fill my need, but could not find any.

So I decided to write my own logic.

Below are my requirements for an application I am going to execute.

Input of the application is: XML data

Output of the application is: EDI (Electronic Data Interchange) representation of the XML data.

I have to apply some business rules on XML data and generate the EDI representation.

Here is my design for the requirement:

  • The Java POJOs, here onwards these are Source POJOs, to represent the xml data. To load xml data into Source POJOs, I am using JAXB.
  • The Java POJOs, here onwards these are Target POJOs, to represent the EDI model.
  • A Java class, here onwards it is XmlToEDIBuilder, to code the business rules
  • Finally I am using FreeMarker Template to get the desired EDI structure out of Target POJOs.

Is my design looks good? Any suggestions would really help me.

like image 982
Ram Bavireddi Avatar asked Feb 22 '26 07:02

Ram Bavireddi


1 Answers

Recently I had a project involving edifact parsing and generation. I used http://www.smooks.org/ framework for that purpose.

Using the framework mentioned above your application logic steps might be the following:

  • parse XML to POJO
  • use precompiled smooks components and your POJO to build your desired edifact version

Smooks components could be extended in case some custom and/or client specific edifact format needed.

Here is the usage example to get you started: https://github.com/lunatech-labs/smooks-examples/blob/master/edifact-in-code-manipulation/src/main/java/example/Main.java

like image 196
Artyom Rebrov Avatar answered Feb 24 '26 21:02

Artyom Rebrov