1. Annotating XML variables
@XmlRootElement(namespace=”className” or name=”className”)
@XmlType(propOrder={“property”, “list”})
public class className{
private int attribute;
private String property;
private String value;
private List
@XmlAttribute(value=”attribute”)
public int getAttribute(){
return this.attribute;
}
@XmlElement(value=”property”)
public String getProperty(){
return this.property;
}
/*
@XmlValue
public String getValue(){
return this.value;
}
*/
@XmlElementWrapper(name=”lists”)
@XmlElement(name=”list”)
public List
return this.list;
}
}
We can define the annotations for extended objects as follows:
@XmlElementRefs({@XmlElementRef(type=extendedClass1.class),@XmlElementRef(type=extendedClass2.class),@XmlElementRef(type=extendedClass3.class)})
public baseClassObject getObject(){
return this.object;
}
adfa