This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Doubt on the JAXB: XML Schema to Java mapping for anonymous complex type.  RSS feed

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please take a look at for full schema

My Doubts is related to this snippet. I have removed other elements in this complexType for clarity.



When I run WSIMPORT on this schema. OrderType.java is generated. Here is how it looks.



It is an anonymous complex type. How did it decide on a name for this complex type.



Tried to look it up in JAXB Spec document. The closest that I could find was 3.6 An Example. I couldn't find an online spec (you need to download PDF and checkout the section) so can't put a html link here. This example looks like ItemType in the spec doc.

Other than that didn't find much in the spec. The other relevant sections that I looked in JAXB spec 2.1

6.7.3 Binding of an anonymous complex type definition
5.6.2 Java Element Class



So wanted to understand if vendors can apply it differently from the spec doc? If so how is the portability guaranteed. Here the element name "OrderItems" has been borrowed as class name as well, other JAXB vendor may not do so. In that case how would it guarantee portability.

Are we supposed to know the JAXB in such detail?? I have read couple of spec documents before and I find JAXB spec doc very much read-unfriendly . But I guess when you deal with a problem like webservices, the spec doc will be equally ugly.
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

Kamal Tripathi wrote:
It is an anonymous complex type. How did it decide on a name for this complex type.


The complex type is not given a name, the element name ("OrderItems") found in the first <element> element in your XML schema snippet.
Note that "OrderItems" appear in a @XmlElement annotation ("element" being the keyword).
Best wishes!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!