Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

convert Excel to XML format

 
fang eve
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an excel file, which i want to convert it to xml using JAVA. anyway to do it?

My concept:
The excel is uploaded and the values are inserted into database. I need to grab the header and the values, and generate out 1 xml file. eg

excel file format:
header1 header2 header3
rs1 rs2 rs3
rs4 rs5 rs6

i would like to store the value in Vector either this way [[header1,header2,header3],[rs1,rs2,rs3]] OR
[[header1,rs1,rs4][header2,rs2,rs5]]

my code is as follow



my desired xml format is
<header1>
<content>rs1</content>
<content>rs4</content>
</header1>
<header2>
<content>rs2</content>
<content>rs5</content>
</header2>
<header3>
<content>rs3</content>
<content>rs6</content>
</header3>

[ July 05, 2006: Message edited by: fang eve ]
[ July 05, 2006: Message edited by: fang eve ]
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generating XML isn't very different from genertaing HTML, which you seem to have implemented already. The XML format you're looking for is column-oriented, not row-oriented like the code you posted, so you need to adapt your iteration logic to that.

I don't understand what you're trying to do with the database, or what storing values in a Vector has to do with generating XML.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic