zebiri djallil zebiri djallil - 1 year ago 60
Java Question

Give a name to an XMLRootElement

This is my bean

package mypackage;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;


@XmlRootElement
@XmlType(propOrder={"columnName", "new_value"})
public class GetUserInfoResponse {

private String columnName;
private String new_value;

@XmlElement(nillable = true, name = "nomChamps")
public String getColumnName() {
return columnName;
}

@XmlElement(nillable = true, name = "ValeurModifiee")
public String getNew_value() {
return new_value;
}

}


And this is the result that i'm getting

{
"getUserInfoResponse": [
{
"nomChamps": "AD_Client_ID",
"ValeurModifiee": ""
},
{
"nomChamps": "AD_Org1_ID",
"ValeurModifiee": ""
}
]
}


I'm getting like a title
getUserInfoResponse
(name of the class java bean)

Now, i want to get a specific title (example
values
in the place of class java name)

like this
enter image description here

Answer Source

Its simple

@XmlRootElement(name="values")
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download