Java tutorial
public abstract class MyAbstractClass { private String value; private String dataType; public String getValue() { return value; } public void setValue(String value) { this.value = value; } public String getDataType() { return dataType; } public void setDataType(String dataType) { this.dataType = dataType; } public abstract String getMatch(); public abstract void setMatch(String match); } import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name="MyAbstractClass") public class MyClass extends MyAbstractClass { private String match; @Override public String getMatch() { return match; } @Override public void setMatch(String match) { this.match = match; } } import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; public class Main { public static void main(String[] args) throws JAXBException { MyClass my = new MyClass(); my.setDataType("data type"); my.setMatch("STRING MATCH"); my.setValue("value"); JAXBContext context = JAXBContext.newInstance(MyClass.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.marshal(my, System.out); } }