Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Do you need xjc to create jaxb classes?


Asked by Kira Ortega on Dec 06, 2021 FAQ



But the good news is, you do not need to do it. If you have a XSD schema description, you can use the xjc binding compiler to create the required classes. And even better, xjc is part of the JDK. So there is no need for external tools and you should always have it at hand if required.
And,
If you have a XSD schema description, you can use the xjc binding compiler to create the required classes. And even better, xjc is part of the JDK. So there is no need for external tools and you should always have it at hand if required.
Also Know, Traditionally we had to use the xjc schema compiler from command prompt or an ant build for generating java code from xsd. However the current Jee eclipse provide inbuilt support for generating the JAXB java classes and interfaces from input xsd. Just right click the xsd and generate jaxb classes.
Furthermore,
JAXB 2.x support bidirectional binding between xml schema (XSD) and java classes - binding from XML schema (XSD) to create java classes and binding of Java classes to create XML Schema components. Here we will see binding from XML schema (XSD) to create JAXB classes and and then do marshalling and unmarshalling.
Thereof,
JAXB is a bridge between the Java and the XML worlds, enabling your code to transparently marshalls and unmarshalls your Java objects to and from XML. In order to do this, you should have a class representing your XML-Schema. This class is created by the xjc.