aspose file tools*
The moose likes Java in General and the fly likes Java Batch program - CSV/XML input file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Batch program - CSV/XML input file" Watch "Java Batch program - CSV/XML input file" New topic
Author

Java Batch program - CSV/XML input file

Piyush Mattoo
Ranch Hand

Joined: Mar 12, 2007
Posts: 30
We have a batch job written in Java which accepts data in the form of files in CSV format. Would it be better to have data coming in XML format since then we can have a schema to maintain consistency across dataset and validate the data against the schema. Do we have any such facility in CSV file format?
Also, is there any way to continue accepting files in CSV format and convert them over to XML at our end? Any good practices around that?

Thanks in advance!


SCWCD-1.4, SCJP-1.4, CSM.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You can transform your data any way you want once you have it. As an example, we get files from clients in maybe 2-3 dozen CSV layouts. We have a process that converts each format into standard XML we then feed into our back end. There are a zillion ways to do this, including commercial products.
Piyush Mattoo
Ranch Hand

Joined: Mar 12, 2007
Posts: 30
Thanks David for the response.
Our batch processes run once a day and i would imagine this conversion process would also happen then once a day sometime before the loader executes. Any recommendation for using any tool for doing the conversion in an automated manner?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Not really; we use a commercial product for most, and hand-craft a few for the oddballs, with a DSL defining the conversions.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Java Batch program - CSV/XML input file