I'm trying to create an xml element which i want to have as prefix the atom. I know that i can't do this:
@XmlElement(prefix="atom")
And create
<XmlAttribute>
<atom:link ...>
</XmlAttribute>
Is there a possible way to do this or not?
I'm trying to create an xml element which i want to have as prefix the atom. I know that i can't do this:
@XmlElement(prefix="atom")
And create
<XmlAttribute>
<atom:link ...>
</XmlAttribute>
Is there a possible way to do this or not?
Yes, you just need to define the namespace corresponding to this prefix:
@XmlElement(name="link", namespace="..")
this will just add the namespace corresponding to the atom
prefix to your link
element. If your question is about specifically getting atom
as the prefix for this namespace, then please look at this question: Is it possible to customize the namespace prefix that JAXB uses when marshalling to a String?