How to create Java Classes using xjc from XML file
.png)
This tutorial will demonstrate how can you generate Java Objects from XML documents using xjc tool. The tool “xjc” is used to generate the annotated Java classes from the XSD schema Suppose I am using below XML file to generate Java Objects i,e <?xml version="1.0" encoding="UTF-8"?> <adaptorapp id="application"> <instance id="instance1"> <connectiondetails> <accesskey>abcde</accesskey> <secretkey>fghij</secretkey> </connectiondetails> </instance> <instance id="instance2"> <connectiondetails> <accesskey>klmnop</accesskey> <secretkey>qrstuvwxyz</secretkey> </connectiondetails> </instance> </adaptorapp> Now to generate Java Objects we need to create one xsd file(say "connection.xsd") : <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema...