This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

file parsing and xml generation  RSS feed

 
Pallab Sen
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a requirement where we have to read some flat files consisting of name-value pairs, process it following some defined rules and then generate XML files out of it. The XML files are static. What should be the base design ? Which parser should we use ?
May be the questions are very basic, as I am totally newbee to the Java world. Please help.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depending on the format of your input files you may be able to use the java.util.Properties class (properties files are just collections of name/value pairs). And even if that doesn't fit your purposes exactly, you may be able to adapt the source code of that class so that it does what you need done.

If you're new to the Java XML world, then it may be easiest to create the XML files directly by printing to a FileWriter. Or if you want to learn an XML API, then the XOM library (www.xom.nu) can be used to create XML files.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!