Hello to all !! I want to convert an xml file to csv format.Can any one help me ..
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12267
1
posted
0
Do you want to turn the elements of the XML into CSV in the same order or do you need to manipulate the data first? Have you read any Java and XML tutorials? Bought a book? Bill
XSLT can be used to tramsform XML to CSV. For an example, check "XML Databases" (published by Wrox), chapter 12. ---- Joel Amoussou IBM XML Certification Practice Test http://www.xmlmentor.net/xmlexamsim.htm
akshay pandit
Ranch Hand
Joined: Jun 15, 2003
Posts: 44
posted
0
First of all thanks for the reply... I have read the xml file using sax parser and want to save the all the read elements/attributes & values and characters in csv format.. Suggestions will be a great help
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12267
1
posted
0
If you want all the contents with various bits separated by commas, just write to an output file from every startElement and characters method. In order to get the commas in the right place you will have to pay attention to the nesting of elements. On the other hand if you are trying to prepare data for interpretation in Excel, you need to think about what you want the resulting spreadsheet to look like. Bill
Suresh Kanagalingam
Ranch Hand
Joined: Aug 17, 2001
Posts: 82
posted
0
Check out apache web site for Xalan samples (http://xml.apache.org/xalan-j/index.html). This site has good samples showing how to convert XML into structured text format. You can change sample code to get your CSV format. Good luck Suresh
akshay pandit
Ranch Hand
Joined: Jun 15, 2003
Posts: 44
posted
0
hi thanks for the solution.. It really helped me a lot.. can u please let me know if we want to do a backward engineering like in our case if we want to transform csv back to xml and xls back to xml then what can be done...? Once again thanks for the reply...
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.