• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAXB - how to support extension via import

 
Tina Coleman
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic