Win a copy of Grokking Bitcoin 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

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: 21718
102
Chrome Eclipse IDE Java Spring Ubuntu VI Editor 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..
 
Ever since I found this suit I've felt strange new needs. And a tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!