I am using the tutorial here for understanding JAXB.
When the writer comes to create the root of the document, the writer begins as below:
//This sta
@XmlRootElement annotation can be used to map a class or enum type to XML type.
When a top level class or an enum type is annotated with the @XmlRootElement annotation, then its value is represented as XML element in an XML document.
Follow the example given below to get more idea:
Associate an element with XML Schema type
// Example: Code fragment
@XmlRootElement
class Point {
int x;
int y;
Point(int _x,int _y) {x=_x;y=_y;}
}
//Example: Code fragment corresponding to XML output
marshal( new Point(3,5), System.out);
3
5