File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes JAXB - how to support extension via import Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "JAXB - how to support extension via import" Watch "JAXB - how to support extension via import" New topic

JAXB - how to support extension via import

Tina Coleman
Ranch Hand

Joined: Dec 12, 2001
Posts: 150
Our team has implemented a core model using JAXB, which we'd now like to allow other teams to extend.

Thus, we'd like to distribute a jar file containing our generated compiled code, with the XSDs as resources. Optimally, other teams would then import our XSDs (so that the new XSD could use its own namespace) and generate JUST their own code. Having difficulty making that happen, though. Two difficulties that I'm having so far:
- pointing to the schema definition within a jar file: I've seen mention of classpath schemaLocations, but those don't seem to work for Xerces.
- If I extract the XSDs, and give explicit schemaLocations (or presumably, post them in an accessible location), the JAXB code generation generates all of the classes, rather than just the set of interest.

I should mention we're using the JAXB reference implementation from Sun, which uses Xerces.

Code for my test extension:

Code for my jaxb binding:
I agree. Here's the link:
subject: JAXB - how to support extension via import
It's not a secret anymore!