Community
Participate
Working Groups
Considering the following annotated Customer and package-info classes: -------------------- @XmlSchema( namespace = "http://www.example.org/package", elementFormDefault = XmlNsForm.QUALIFIED) package documentation; import javax.xml.bind.annotation.XmlNsForm; -------------------- package documentation; import javax.xml.bind.annotation.*; @XmlRootElement @XmlType(namespace="http://www.example.org/type") public class Customer { public String name; } -------------------- Marshalling an example object would look like this: <?xml version="1.0" encoding="UTF-8"?> <customer xmlns="http://www.example.org/package" xmlns:ns0="http://www.example.org/type"> <ns0:name>Bob</ns0:name> </customer> - customer has "package" namespace - name has "type" namespace (inherited from Customer type) ==================== The equivalent XML Bindings file should look like this: <?xml version="1.0" encoding="US-ASCII"?> <xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" package-name="documentation"> <xml-schema element-form-default="QUALIFIED" namespace="http://www.example.org/package"> </xml-schema> <java-types> <java-type name="Custom"> <xml-root-element /> <xml-type namespace="http://www.example.org/type" /> <java-attributes> <xml-element java-attribute="name" /> </java-attributes> </java-type> </java-types> </xml-bindings> Now when marshalling, even though the "type" namespace is defined, it is not used on the "name" element: <?xml version="1.0" encoding="UTF-8"?> <custom xmlns="http://www.example.org/package" xmlns:ns0="http://www.example.org/type"> <name>Bob</name> </custom>
Created attachment 203179 [details] Work in progress
Created attachment 203526 [details] Patch - 2.4
Created attachment 203527 [details] Patch - 2.3
During review it was uncovered that the same problem exists for XmlAttributes.
Created attachment 203796 [details] Patch - 2.3
Created attachment 203797 [details] Patch - 2.4
Fixed and checked in to 2.3.1 and 2.4, reviewed by bdoughan and dmahar. New test case: org.eclipse.persistence.testing.jaxb.externalizedmetadata.namespace.NamespaceTestCases
Resolved.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink