0

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?

Alex Dowining
  • 980
  • 4
  • 19
  • 41

1 Answers1

1

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?

Community
  • 1
  • 1
Biju Kunjummen
  • 49,138
  • 14
  • 112
  • 125