Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CSV to XML coding in Java

 
kumar m
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13048
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Plus, you'll fine more help in the XML forum, where this post is being moved to.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic