I am using JAXB (version included in JDK 6) to sort objects in XML. The following code snippet gives unexpected results:
public class JAXBTest {
@XmlRootElement
public static class VIPPerson {}
public static void main(String[] args) throws JAXBException {
StringWriter sw = new StringWriter();
VIPPerson p = new VIPPerson();
JAXB.marshal(p, sw);
System.out.println(sw.toString());
}
}
code> Conclusion from the above<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<vipPerson/>
I expect to see the name of the class associated with the element VIPPerson, and not VIPPersonbased on section 8.12.1 in the JAXB specification , which states that
class name: the class name is mapped to the XML name in uppercase using java.beans.Introspector.decapitalize (class name).
The JavaDoc for this method decapitalizesays the following:
, Java. , , () , , , , . , "FooBah" "fooBah", "X" "x", "URL" "URL".
- ?