JAXB Java generating XML, Why lowercase?
For specific elements...
@XmlElement( name = "Code")
private String code;
For the object....
@XmlRootElement(name="Employee")
public class Employee{ ...
The behaviour you are seeing is the result of the standard JAXB (JSR-222) XML name to Java name conversion algorithm.
You can use the @XmlRootElement
annotation to specify a name:
@XmlRootElement(name="Employee")
@XmlAccessorType(XmlAccessType.FIELD)
class Employee {
...
}
I'm the EclipseLink JAXB (MOXy) lead, and we have an extension that allows you to override the default name conversion algorithm that you may be interested in:
- http://blog.bdoughan.com/2011/05/overriding-jaxbs-name-mangling.html