• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

CSV to XML coding in Java

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Plus, you'll fine more help in the XML forum, where this post is being moved to.
 
reply
    Bookmark Topic Watch Topic
  • New Topic