Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6180717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:53:37+00:00 2026-05-24T00:53:37+00:00

i am working on converting CSV to XML, though i have many ways to

  • 0

i am working on converting CSV to XML, though i have many ways to do this but my requirement is to do it in such a way that in future the mapping can be changed without any code change.
so we are using the following approach.
we are using Apache camel for the integration so CSV is being converted out of the box by camel and is being provided as a List<List<String>>
with data something like

{[header1,header2,header3],[1,2,3],[2,4,5]}

i need to convert this list data to XML is the defined form but since i can’t use the java mapping so was planning to do something like
to convert this List in to a flat XML file using XStream and than use xslt to map the raw XML file to xslt, but when i am XStream to convert List to XML it giving following output

<list>
  <java.util.Arrays_-ArrayList>
    <a class="string-array">
      <string>Quantity</string>
      <string>Price</string>
      <string>Total</string>
      <string>Date</string>
      <string>ID</string>
      <string>Name</string>
      <string>Ref#</string>
    </a>
  </java.util.Arrays_-ArrayList>
  <java.util.Arrays_-ArrayList>
    <a class="string-array">
      <string>4</string>
      <string>1.13</string>
      <string>4.52</string>
      <string>9/4/2008</string>
      <string>275</string>
      <string>Blue Ink</string>
      <string>49385730</string>
    </a>
  </java.util.Arrays_-ArrayList>
  <java.util.Arrays_-ArrayList>
    <a class="string-array">
      <string>5</string>
      <string>2.16</string>
      <string>2.16</string>
      <string>8/3/2008</string>
      <string>229</string>
      <string>Red Ink</string>
      <string>20549348</string>
    </a>

my sample CSV is

Quantity,Price,Total,Date,ID,Name,Ref#
4,1.13,4.52,9/4/2008,275,Blue Ink,49385730
5,2.16,2.16,8/3/2008,229,Red Ink,20549348

so it seems not possible to map this raw XML to the required XML using XSLT.
Is there any way to convert this List data in to some more presentable XML format so that we can map that XML with XSLT to avoid any code change.
Or is there any other more efficient way to convert this list in to XML structure

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:53:38+00:00Added an answer on May 24, 2026 at 12:53 am

    The way how the generated XML is described (headers become the element tags), it is really hard to generate without custom programming. The best bet would be to write some code yourself using DOM4J.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Working on converting an array to another array. In PHP, this is easy, but
I am working on converting a CVS repository that has the following symbols (among
I'm working on a project that involves converting a large amount of HTML content
I'm working on converting a bit of code to SSE, and while I have
I am currently working on converting an application from access to C# and have
I'm working on converting a mathematical formula into a program. This formula is called
I'm working on converting a stored procedure from SQL server to Oracle. This stored
I am currently converting a very old, but working classic ASP site to ASP.Net.
I have been working on a document conversion feature for converting a docx file
Morning all I'm converting a site that I'm working on to be compliant with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.