• 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

JAXB does not generate @XmlRootElement  RSS feed

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why does JAXB put @XmlRootElement sometimes but not always?

The above link is preety much where i am stuck.. It does not generate @XmlRootElement.. I also tried using their solution of :

jaxb-xjc version : jaxb-xjc-2.1.10.jar.. so i have changed my jaxb:version to 2.1 from 1.0 above...

Generated Code from above XSD



I just can't get it to generate @XmlRootElement over my class...something like below


(P.S.) I need it for my web services implementation...

Thanks you very much...
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This probably belongs in the "Web Services" forum...

You haven't actually defined any elements in your schema, just a type. Obviously, you have to decide what makes the most sense in terms of your schema design, but what if you change it to something like:



Read the java.net blog entry a bit more carefully and you'll see that it's really addressing elements and not types...which makes sense given the name of the annotation: XmlRootElement
 
Sheriff
Posts: 21461
96
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kris Schneider wrote:This probably belongs in the "Web Services" forum...


So that's where this thread is going.
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Take a look at this web page: http://weblogs.java.net/blog/2006/03/03/why-does-jaxb-put-xmlrootelement-sometimes-not-always
It should answer your question.
Best wishes!
 
Kris Schneider
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ivan Krizsan wrote:Take a look at this web page...



Which is the exact same page referenced in the original post...on the first line.

Ivan Krizsan wrote:It should answer your question.



If hindsight is any guide, I'm guessing not.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kris Schneider wrote:
Which is the exact same page referenced in the original post...on the first line.


Sorry, I did not see the link, my fault.
 
Anish Shah
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kris.. you were so right.. its about the Element as you said.. I had to change my design around but it worked.. Thank you very much for your advice..
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!