Thursday, July 3, 2014

Generate java classes from xsd using JAXB

We can use JAXB to do this job.

More info:
https://jaxb.java.net/

JAXB bundles with JDK kit from 1.6 onwards.

You can find a service called 'xjc' in the <jdk directory>/bin folder.

Example:
C:\Program Files\Java\jdk1.6.0_30\bin>xjc D:\Modules\functionalModules.xsd
parsing a schema...
compiling a schema...
generated\FunctionalModule.java
generated\FunctionalModules.java
generated\ObjectFactory.java

Java classes will be generatd with in the 'generated' folder of java bin directory.

No comments:

Post a Comment