@XMLRootElement versus @XmlType

Viewed 54148

What's the difference between annotating a class with @XMLRootElement and @XMLType. I've been annotating classes with @XMLType when the structure will be used more than once within an XML schema and with @XMLRootElement when it will be used only once - is this the best approach?

A different but related question which I'll include here. The @XMLType annotation has an propOrder attribute to specify in which order its elements appear - is there an equivalent for @XMLRootElement?

I'm using these annotations in conjunction with JAX-WS annotations to create web services if that makes any difference.

2 Answers
Related