Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

xml without root element -- JAXB.  RSS feed

 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have xsd A and B, A generates classes having annotations "root element" but B doesn't

Questions:

1 - How do I know which xsd will generate classes with "root element" annotations?
2 - and Can I still generate (marshall and unmarshall) without a root element? if yes please guide me to a tutorial...

Thanks a lot in advance!
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"generate classes"

What tool are you using here? There are many.

Bill
 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry I missed that, its jaxB...

and I found out some things while going through the classes...

Compilation error

@XmlElementRef(name = "readyTime", type = JAXBElement.class, required = false)

Error: The attribute required is undefined for the annotation type XmlElementRef

I dont understand, is this schema a old one or a new one ? : (
 
Akira Funahashi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess you used JAXB 2.2 to generate the code.
Changing your JAXB from 2.2 to 2.1 might solve this problem.
Hope this helps,
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!