Search code examples
jaxbjaxb2

jaxb - generate classes from single schema in different packages depending on namespace


My requirement is that I have a very big schema and it has many different tags with different namespaces. I want to generate classes from that schema into different packages and I want this thing to be bases on namespace i.e. I want classes corresponding to tags in one namespace to be in one package and classes corresponding to tags in other namespace to be present in different name space. I want an ant task to perform the above functionality


Solution

  • Actually, this is normal JAXB behaviour: XJC derives packages from namespace URIs (http://www.acme.com/foo -> com.acme.foo).

    Here's a sample Ant "Purchase Order" project:

    http://confluence.highsource.org/display/J2B/Downloads