Home > Development, Java > Create Java Classes from XML-Schema

Create Java Classes from XML-Schema

December 23rd, 2011

JAXB (Java Architecture for XML Binding) is a framework to marshal Java objects to XML and vice-versa.
It is part of the JDK and comes with a command-line compiler (xjc) that creates Java classes from an existing XML-Schema.

Location
The xjc it located at the /bin folder of the JDK:
../jdk1.6.0_18/bin/xjc.exe

Usage
xjc -d [target folder] -p [package name] [xml-schema file name]

Example
The classes will be written to the folder “src” (relative to the current location) in the package “de.myproject.somepackage”.
The schema file “my-schema.xsd” will be compiled.
xjc -d src -p de.myproject.somepackage my-schema.xsd

For more information see
xjc -help

  1. February 2nd, 2012 at 01:17 | #1

    I like this post, enjoyed this one thanks for posting .

Comments are closed.
View Count for today / total - Preview: 2 / 2,392, Read: 0 / 342, Index: 2 / 912