I have to load information from an Employee contained in a text file (one field per line), and convert it to a XML or JSON representation MATCHING a schema provided. And this last part it's what I am not sure. I know to load the data, and convert it to XML and also to convert from XML to JSON using XSLT, but how about to matching the schema?
Thanks in advance
assuming you are working with a fixed schema, you just build your xml so that it matches your schema. if you are working with a schema that will be defined at runtime, that's a much harder problem. since you refer to using a REST framework in your other question, i would assume you have a fixed schema. most REST frameworks utilize some sort of pojo to xml/json mapping framework (e.g. jaxb,jackson) so i would imagine you would be best off using one of those instead of hand-rolling the xml generation code.
I will answer myself.
I have used a Java API for XML Binding technology. I have tested JAXB and JiBX. Finally I used JAXB in eclipse to create the domain Java class from the schema. Then, in the Dao I read data from the file and create the domain object.