Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 365480 - JAXB error marshaling xsi:type value when object is in a different namespace from owner
Summary: JAXB error marshaling xsi:type value when object is in a different namespace ...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-02 15:18 EST by Denise Smith CLA
Modified: 2022-06-09 10:19 EDT (History)
1 user (show)

See Also:


Attachments
Proposed changes and test (11.17 KB, patch)
2011-12-02 15:48 EST, Denise Smith CLA
no flags Details | Diff
2.3 patch (11.29 KB, patch)
2011-12-19 16:17 EST, Denise Smith CLA
no flags Details | Diff
Additional test cases (39.54 KB, patch)
2012-01-03 15:12 EST, Denise Smith CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Denise Smith CLA 2011-12-02 15:18:05 EST
Given the model below we should get XML like this if we marshal a Root that has baseTypeThing set to an instance of SubType.

<ns0:root xmlns:ns0="rootNamespace"><baseTypeThing xmlns:ns1="someNamespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:subType"/></ns0:root>

but instead the xsi:type attribute is not adding hte ns1 prefix.


@XmlRootElement(name="root", namespace="rootNamespace")
public class Root {
	public BaseType baseTypeThing;
}

@XmlType(namespace = "someNamespace")
public class BaseType {
}

@XmlType(namespace = "someNamespace")
public class SubType extends BaseType{
}
Comment 1 Denise Smith CLA 2011-12-02 15:48:03 EST
Created attachment 207866 [details]
Proposed changes and test
Comment 2 Denise Smith CLA 2011-12-05 10:04:59 EST
Patch checked in to 2.4 but should also be put in 2.3.3.   Patch sets the prefix on the schema context qname so it is used by XMLObjectBuild but additionally need to investigate XMLObjectBuilder as a prefix should be generated if needed during marshal.
Comment 3 Denise Smith CLA 2011-12-19 16:17:43 EST
Created attachment 208586 [details]
2.3 patch
Comment 4 Denise Smith CLA 2011-12-20 10:18:35 EST
Also checked in 2.3 patch to 2.3.3
Comment 5 Denise Smith CLA 2012-01-03 15:12:38 EST
Created attachment 208958 [details]
Additional test cases
Comment 6 Denise Smith CLA 2012-01-03 15:21:36 EST
Additional test cases patch checked in to 2.3 and trunk
Comment 7 Denise Smith CLA 2012-05-15 16:45:06 EDT
Checked in to 2.3 and trunk and all tests passing.  Wasn't able to find any cases where the prefix wasn't generated if needed.
Comment 8 Eclipse Webmaster CLA 2022-06-09 10:19:15 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink