JAXB, XJC -> create multiple class files
By default JAXB (JSR-222) will create static inner classes for nested complex types to prevent class name conflicts. You can use an external binding file to disable this behaviour.
binding.xml
A binding file allows you to customize how Java classes are generated from an XML schema.
<jaxb:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" version="2.1"> <jaxb:globalBindings localScoping="toplevel"/></jaxb:bindings>
XJC Call
The -b
option is used with the XJC command to specify a binding file.
xjc -b binding.xml myschema.xsd
For More Information