I am writing a simple CSV to XML processor in Java.
I am using JAXB to generate a model in java from a DTD. I need to process the CSV format into this model, and then marshall it into the XML that complies to the DTD. I am using JAXB to marhall the data from the Java model to the XML. I have to write the CSV-Model mapping myself.
At the moment, I can think of no better solution than to straight map the CSV to the Java model by reading it in and assigning it to the model in code.
Is there a more elegant solution to this that you can think of? Perhaps some reusable mapping library etc?
Thanks in advance.
I usually use the flatpack library to parse CSVs into Java Models : Flatpack Project on sourceforge
It is quite simple to use and use XML mappings to handle the CSV to Model projection (thus not inducing thight coupling between your csv and your java objects)