Forums Register Login

Flat File to SOAP XML

+Pie Number of slices to send: Send
I have never worked with XML and SOAP envelopes. I am trying to write a generic algorithm to read a flat file and to write the details into a SOAP like XML file. I was thinking of the following approach but want to know if there would be a better approach to do it.

  • Create a file containing the sample XML envelope with variables instead of the actual values
  • Create a properties file which contains a mapping between the variables and the index of the column (containing value for this variable) in the flat file.
  • Read the Flat file line by line in Java Code. Convert the line to an ArrayList based on the columns in the line
  • For each line, I read the sample XML envelope as defined in Step 1 above. I replace the variables in the XML string with the values from the arraylist based on the associated variable index.
  • Write the XML to a file.


  • I can write the xml file by javax.xml.soap.MessageFactory but that would make the mapping complex and would probably take more time to execute.

    Any suggestions on the right approach to achieve this?
    a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com


    reply
    reply
    This thread has been viewed 568 times.
    Similar Threads
    Flat File Index (Very Urgent)
    Assignment
    Suggestions on Parsing Huge XML File
    Sample Questions for 288 - Need answers
    Peformance comparison question
    More...

    All times above are in ranch (not your local) time.
    The current ranch time is
    Mar 28, 2024 19:08:55.