Community
Participate
Working Groups
When using Annotations vs. Bindings, the way in which the XmlRootElement's namespace is declared in marshalled XML is inconsistent. Annotations: @XmlRootElement(namespace="ROOT") public class Company { @XmlElement(name="employee") public List<Employee> employees = new ArrayList<Employee>(); } ===== XML Bindings: <java-type name="CompanyB"> <xml-root-element name="company" namespace="ROOT"/> <java-attributes> <xml-element java-attribute="employees" name="employee" type="documentation.EmployeeB" container-type="java.util.ArrayList" /> </java-attributes> </java-type> ===== Marshalled XML: Annotations: class org.eclipse.persistence.jaxb.JAXBContext <?xml version="1.0" encoding="UTF-8"?> <company xmlns="ROOT" xmlns:ns0="http://www.example.org/package"> Bindings: class org.eclipse.persistence.jaxb.JAXBContext <ns0:company xmlns:ns0="ROOT" xmlns:ns1="docs"> Although functionally equivalent, the Bindings approach should look the same as when using Annotations.
* Corrected XML: Annotations: class org.eclipse.persistence.jaxb.JAXBContext <?xml version="1.0" encoding="UTF-8"?> <company xmlns="ROOT"> Bindings: class org.eclipse.persistence.jaxb.JAXBContext <ns0:company xmlns:ns0="ROOT">
Can no longer reproduce this behaviour, seems to have been fixed by a previous patch. Annotation and Bindings now look the same: Annotations: class org.eclipse.persistence.jaxb.JAXBContext <?xml version="1.0" encoding="UTF-8"?> <ns0:company xmlns:ns0="ANNO"> ... </ns0:company> OXM: class org.eclipse.persistence.jaxb.JAXBContext <?xml version="1.0" encoding="UTF-8"?> <ns0:company xmlns:ns0="BIND"> ... </ns0:company>
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink