I thought of following one approach if client different EDI formats.
I will explain in detail.If user sends different EDI formats without touching java code i want to build the code in a generic way.
my intention is the code should work for all kind of EDI formats.
if client sends differents EDI formats intially i will map it only at DB side once.
for this i have created one table.in this table i will mention the EXISTING_APPLICATION_ID where this field is mapped to xml tag.we can see the values below for the 2 different EDI formats.you can also check the xml files.
if you see the java code i am getting the values from DB agaisnt field names in the application.
Xpath is used to retrive the values agaist xml tags specied in the table.
Can you please anybody tell me how is my approach?will the code suffice if client sends different type of edi formats.
can anybody light on the code on Xpath related code.will it be any performance related issues will come?
can we write more generic way better than this?
As long as there's a one-to-one mapping, it might be ok. To me the code seems very clunky and verbose, but that's a different issue.
Personally I think I would have implemented an interface and written an adapter between incoming formats and whatever format you end up needing it in, thus allowing wildly disparate inputs to still work. If you're just trying to allow different XML element names and everything else is identical, then keeping the possible mappings in the DB is probably fine.
You should definitely take a look at DataDirect XML Converters, if you're looking to convert standard EDI dialects to an arbitrary XML format and vice versa. If you need to support EDI that doesn't conform (entirely) to a standard dialect you can do so using the Standard Exchange Format (SEF).
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Joined: Apr 24, 2008
Thanks for the reply.first time i heard about DataDirect XML Converters.here my requirement i will get different XML formats(.xml) from the customer.even though i get different xml formats.for every xml formats it should have a FIRSTNAME,LASTENAME,'FLIGHTCODE','FLIGHTNAME' values in it.
Even though xml tag's are different but eventually all of them should be inserted into these DB columns FIRSTNAME,LASTENAME,'FLIGHTCODE','FLIGHTNAME' etc.my intension is i shouldn't change the code at java side.only one time mapping should be happened for every xml format.in what way DataDirect XML Converters will be useful in my requirement.