It's not a secret anymore!
The moose likes Beginning Java and the fly likes xls to xml conversion application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "xls to xml conversion application" Watch "xls to xml conversion application" New topic
Author

xls to xml conversion application

sai rama krishna
Ranch Hand

Joined: May 29, 2009
Posts: 397
Hi,

I have a xls file with two sheets namely sheet1 and sheet2

sheet 1 having 3 columns say

1. product 2. total 3. cost
has about 100 records


sheet2 also having same 3 columns say

1. product 2. total 3. cost
has about 10 records.

I need to convert above xls to xml with similar structure as follows


<sheet1>
<product1>
<product></product>
<total></total>
<cost></cost>
</product1>
<product2>
<product></product>
<total></total>
<cost></cost>
</product2>
.....more products
</sheet1>

<sheet2>
<product1>
<product></product>
<total></total>
<cost></cost>
</product1>
<product2>
<product></product>
<total></total>
<cost></cost>
</product2>
.....more products
</sheet2>

what is the best way to achieve it. Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance



Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42958
    
  73
You can use Apache POI to read the file, and then use any number of XML APIs to write it, like DOM, JDom, XOM etc.
 
Have you checked out Aspose?
 
subject: xls to xml conversion application
 
jQuery in Action, 3rd edition