| Summary: | Extraneous xsi:type written out when using inheritance / XmlSeeAlso | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Rick Barkhouse <rick.barkhouse> | ||||||
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | blaise.doughan, denise.mahar, eclipselink.oxm-inbox | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
This bug is captured in the following test case: org.eclipse.persistence.testing.jaxb.javadoc.xmlseealso.XmlSeeAlsoTest (Praba is working on these tests and they have not been checked in yet, the above test class name may change) Created attachment 195538 [details]
Proposed changes and test
Created attachment 195769 [details]
Updated patch
The xsi:type will not get marshaled out in this case anymore. Modifications so that on an XMLDescriptor setDefaultRootElementType will be called to set the type if it is known. This will be used for comparison during marshal to help determine if an xsi:type attribute should be added or not. The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
Consider the following classes: @XmlRootElement @XmlSeeAlso({Dog.class, Cat.class}) public class Animal { public String name; } @XmlRootElement public class Cat extends Animal { public int sleepTime; public Dog enemy; } public class Dog extends Animal { public String barkLevel; } Note that both Animal and Cat have @XmlRootElement defined. When a new Cat is created and marshalled, an unnecessary xsi:type attribute is written out: <?xml version="1.0" encoding="UTF-8"?> <cat xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="cat"> <name>Fluffy</name> <sleepTime>10</sleepTime> <enemy> <name>Buster</name> <barkLevel>LOUD</barkLevel> </enemy> </cat>