Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

JAXB - how to support extension via import

Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
You can't expect to wield supreme executive power just because
We need your help - Coderanch server fundraiser
    Bookmark Topic Watch Topic
  • New Topic