• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JAXB does not generate @XmlRootElement

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 22821
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic