I am using JAXB to create the xml using java Objects.
I am trying to create this tag:
<preTaxAmount currency="USD">84</preTaxAmount>
For this I am using following domain class:
public class PreTaxAmount
{
@XmlElement(required = false, nillable = true, name = "content")
private String content;
@XmlElement(required = false, nillable = true, name = "currency")
private String currency;
public String getContent ()
{
return content;
}
public void setContent (String content)
{
this.content = content;
}
public String getCurrency ()
{
return currency;
}
public void setCurrency (String currency)
{
this.currency = currency;
}
}
The above code is producing the following xml:
<preTaxAmount>
<content>380.0</content>
<currency>USD</currency>
</preTaxAmount>
This format is way to different than required one. How to get the desired format.