This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes convert Excel to XML format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "convert Excel to XML format" Watch "convert Excel to XML format" New topic

convert Excel to XML format

fang eve

Joined: Jun 22, 2006
Posts: 26
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

my code is as follow

my desired xml format is

[ July 05, 2006: Message edited by: fang eve ]
[ July 05, 2006: Message edited by: fang eve ]
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
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.
I agree. Here's the link:
subject: convert Excel to XML format
It's not a secret anymore!