wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes CSV to XML coding in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "CSV to XML coding in Java" Watch "CSV to XML coding in Java" New topic
Author

CSV to XML coding in Java

kumar m
Greenhorn

Joined: Aug 20, 2002
Posts: 13
Hi All,
Can you give me a suggession to convert Comma Seperated Value (CSV) text file to XML file. I have to convert the CSV to XML and display the XML file in the front end using XSL.
Using java servlet and xsl.
Please help me with coding.
Thank you
Regards
kumar.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
You can parse a CSV line using a java.util.StringTokenizer - use the form that returns tokens so you can count the fields.
Writing XML can be as simple as lots of println statements to a PrintWriter writing to a java.io.CharArrayWriter.
Bill
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Plus, you'll fine more help in the XML forum, where this post is being moved to.
 
Consider Paul's rocket mass heater.
 
subject: CSV to XML coding in Java
 
Similar Threads
xml file to csv file conversion using java
Display euro symbol in CSV with xml + xslt
File not found exception for xsl file
Trim space in XML
Convert XML to XML using XSL