• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Convert XSD to POJO

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I try to use xjc to create POJOs, I get the following error.  I am new to using jaxb to create POJOs, any help would be appreciated.



Here is the qstat.xsd


 
Saloon Keeper
Posts: 21133
134
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup. It means what it said.

You defined the "state" attribute as both an attribute of the job_list and as a sub-element type. The compiler considers that to be ambiguous. Which one would the "getState()" method retrieve?

I think the suggested cure means that you can annotate with jaxb:property to supply an alternative alias name for one of the state components of the xsd so that it can have its own uniquely named "get" method.
 
Russ Martinez
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:Yup. It means what it said.

You defined the "state" attribute as both an attribute of the job_list and as a sub-element type. The compiler considers that to be ambiguous. Which one would the "getState()" method retrieve?

I think the suggested cure means that you can annotate with jaxb:property to supply an alternative alias name for one of the state components of the xsd so that it can have its own uniquely named "get" method.



So this would happen even if the element is in a different complexType?  Can you give me an example on how I would create an alias for the state?

-Thanks
 
Tim Holloway
Saloon Keeper
Posts: 21133
134
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, as it happens, a certain other technical resource website has an example of exactly your problem and a solution. Which is only fair, since we do explanations at the Ranch, but they specialize in quick copy/paste solutions.

https://stackoverflow.com/questions/4394134/jaxb-property-value-is-already-defined-use-jaxbproperty-to-resolve-this
 
We don't have time to be charming! Quick, read this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!