Quite sometime back I had written about Using JAXB to generate XML from the Java, XSD. And now I am writing how to do the reverse of it i.e generating Java objects from the XML document. There was one comment mentioning that JAXB reference implementation and hence in this article I am making use of the reference implementation that is shipped with the JDK.
We can use JAXB to marshal the Java objects into XML using the given Schema and vice versa- unmarshal XML into Java objects. The xml schema can be specified in DTD, XSD or other format. The tool “xjc” is used to generate the annotated Java classes from the XSD schema. One can download the Java WSDP from here, it includes the JAXB implementation tools required. Here I will throw light on how to generate XML dynamically. Even I havent gone in depth with JAXB, but I found this really useful and thought of sharing it in the blog.