tags:

views:

945

answers:

9

Hi, As title but would like the flexibility to specify how the output xml file will look like. Any free tool available on windows platform that I can use to achieve that? Thanks

+1  A: 

You could read it into a dataset and use the dataset's WriteXML methods to output to XML.

It looks like this guy used XSLT.

Charles Graham
A: 

Since its open source, you should find the flexibility you need. http://csv2xml.sourceforge.net/

Jim Burger
A: 

I think what you're looking for is Microsoft LogParser. Jeff did a post about it awhile back. Here are the forums if you need it but it's pretty straight forward.

Richard Nienaber
A: 

Hmm.. I am looking for more a ready use tool, not really for programming purpose, I checked this http://csv2xml.sourceforge.net/ before posting but it lack the flexibility for me to configure how the output format look like,

smalldream
A: 

I haven't tried this but it looks like it handles your problem.

Good luck!

wcm
+1  A: 

Use XSLT to obtain required output format.

CSV -> CSV2XML -> XSLT -> XML

XSLT is the true and straight way "to specify how the output xml file will look like".

Yurii Soldak
+1  A: 

You can use DBUnit and Java:

import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.excel.XlsDataSet;
import org.dbunit.dataset.xml.FlatXmlDataSet;

public class XlsToXml {
    public static void main(String[] args) {    
        try {
            FileInputStream stream = new FileInputStream(args[0]);
            IDataSet dataset = new XlsDataSet(stream);
            OutputStream out = new ByteArrayOutputStream();
            FlatXmlDataSet.write(dataset, out);
            System.out.println(out);
        } catch (Exception e) { 
            e.printStackTrace();
        }
    }        
}

This will give you cells as attributes. Use XmlDataSet instead of FlatXmlDataSet if you want your XML formatted differently.

neu242
A: 

You can use Elev.at (http://elev.at) to convert from XLS to XML. It is a free web API.

Joubert Nel
A: 

You can use "cz excel converter" to convert Excel to xml Format, and this tool supports command line interface, so you can call it from your application, you can get demo version and more information from http://www.convertzone.com/excel_converter/help.htm

If you need batch convert converts PDF, XLS, HTML, XML, MTH, CSV, TEXT, DBF, Lotus 1-2-3, WKS, WQ1, SLK, DIF and more, "cz excel converter" will help you, it can convert many excel xls files at one time.

regards
flyaga

flyaga