Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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 ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Need help setting a JAXB bindings.xjb file

 
Ranch Hand
Posts: 125
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having trouble figuring out to set up a bindings.xjb file for JAXB in a case where I have two separate schema files that define a simpleType with the same name and thus produce a conflict. The xjc command reports "A class/interface with the same name is already in use. Use a class customization to resolve the conflict."

I can get JAXB to work if I edit the schema files by hand, but since they are part of a large schema provided by a government agency and really out of my control, I feel that the "proper" way to handle this is through a bindings file, especially since the government schemas are subject to change periodically and I don't want to have to get into a situation where I am editing them anew with every release.

Could anyone point me in the right direction on this one?

The government schemas are complex, so I've tried to distill this down to a simple example which closely follows what happens in the real schema. Imagine that we have two schema files AppleSchema.xsd and OrangeSchema.xsd. Both include a simpleType called "varietyType" that defines valid varieties such as "Jonathan", "Granny Smith" and "Spy" for apples and "Valencia", "Cara Cara", etc. for oranges. Both are imported by a common schema file called "Fruit.xsd"

Anyway, I made up an example of what AppleSchema.xsd might look like (apologies in advance on my weak use of the language... XML is not one of my great enthusiasms):



I tried setting up a bindings.xjb file as shown below to try to map the varietyType name to be appleVarietyType


When I try running something like xjc -b bindings.xjb AppleSchema.xsd I get the following error message:

[ERROR] compiler was unable to honor this property customization. It is attached to a wrong place, or its inconsistent with other bindings.
line 6 of file:/C:/Users/gwlucas/Documents/bindings.xjb

[ERROR] (the above customization is attached to the following location in the schema)
line 3 of file:/C:/Users/gwlucas/Documents/AppleSchema.xsd



 
My favorite is a chocolate cupcake with white frosting and tiny ad sprinkles.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic