• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

below code is correct way to write the code in generic way if we receive different xml formats

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

It'd make me nervous, though.
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
subba rao
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

i hope you understood my problem.
 
Yeah, but is it art? What do you think tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic