Posts tagged unmarshall
As a followup to my recent article on how to Produce and XML document based on data in a POJO structure using JAXB (http://technology.amis.nl/blog/12499/creating-an-xml-document-based-on-my-pojo-domain-model-how-will-jaxb-help-me) I will describe in this article how to go the reverse route: how to take any XML document and process it into a Java Object graph. I will do that using JAXB.
The steps described in this article are:
- create XSD based on the XML document that I want to turn into Java objects
- generate a JAXB Java class structure based on the XSD
- use JAXB to unmarshall the XML document from file or URL into the Java objects
- retrieve information from the POJOs that are instantiated by the unmarshalling
The tool I use in this article is JDeveloper 11g. However, everything is based on standard technology and will work anywhere (except for the creation of the XSD based on an XML, that is a specific XML IDE feature).