I can create an XML element in Java by using the annotation javax.xml.bind.annotation.XmlElement
@XmlElement(name="foo")
that produces the following XML element
<foo/>
Now, I want to create the following tag:
<foo attr="attrval"/>
How can I do that by using annotations?