This annotation adds information that would be available from a schema type, but isn‘t implied by a Java class declaration. The annotation has several attributes:
factoryClass
and factoryMethod
define the class containing a no-argument method for creating an instance of this class as the equivalent of an empty XML element.name
provides the XML schema name if you don‘t want to use the class name.namespace
attribute provides the name of the target namespace.propOrder
establishes an ordering of the sub-elements. (It‘s pretty obvious that there can‘t be a connection between the textual order of items in a class definition and the order its fields are returned by reflection methods.)Here is an example for XmlType
, requesting that the elements title
, items
and cluster
should appear in the given order:
@XmlRootElement @XmlType( propOrder={ "title", "items", "cluster" } ) public class Document { ... }
JAXB - Annotations, Annotation for Classes: XmlType
原文:http://www.cnblogs.com/huey/p/5511701.html