JAXB – Convert Large XML to Java Class

Lets assume that you have only a xml file not xsd schema. Here let’s see how to convert a large xml file to java pojo classes which helps to set the values to Entity Classes for easy database insertion/updation.

  1.  Generate XSD from XML file using xsd-gen. Or you can also try Microsoft XSD inference tool is a good, free solution.Many XML editing tools, such as XmlSpy or OxygenXML Editor also have that feature.


2.  Go to jdk../bin. Use xjc tool to generate JAXB classes using below command.

3.   Unmarshal it like below and map to corresponding JAXB class.

4.  Map/Set the JAXB classes to corresponding entity classes for database persistence.

That’s it. Using below comment please let me know if you want any other information.






About mohan

This is Mohan Jayapalan author of TechPages Blog.I am a part time blogger and Currently working for private Software Concern.

© Copyright 2010-2016 www.techpages.org · All Rights Reserved · Powered by WordPress ·