Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • 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:
 
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!