| Summary: | Binder issue with @XmlElements | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | tibobd |
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> |
| Status: | NEW --- | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | aumand, blaise.doughan, david.twelves, iaroslav.savytskyi, matt.macivor, sebastian.bosse |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
|
Description
tibobd
This is a bug with how EclipseLink handles a Node replace with XmlElements/ChoiceMappings. In the case of a choice it's very difficult to correctly replace all the possible choice elements with the contents of the new list, especially if the elements within the choice have different levels of nesting (configured via EclipseLink's @XmlPaths annotation) The JAXB RI, also fails to handle this, and when I run the same test with the RI, the comment is removed from the document. In EclipseLink the current support for Binder with a Choice will incorrectly remove and re-add the elements that match the choice. These elements will be added back in their correct position relative to other mapped content, but may end up in the wrong spot relative to unmapped content such as comments, processing instructions or other unmapped elements. This should be fixed to preserve the correct locations of the elements in question at least in the case that all possible choice elements are at the same level of nesting. This bug will be targeted to be fixed in the 2.3 timeframe. I am facing exactely the same problem. When using @XmlElements the binder.updateXML() destroys my original order.
Short snippet of the model class:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"swservicerefOrSWSERVICEREFSYSCOND"
})
@XmlRootElement(name = "SW-SERVICE-REFS")
public class SWSERVICEREFS {
@XmlElements({
@XmlElement(name = "SW-SERVICE-REF-SYSCOND", type = SWSERVICEREFSYSCOND.class),
@XmlElement(name = "SW-SERVICE-REF", type = SWSERVICEREF.class)
})
...
Binder implementation is done as per exmaple: http://blog.bdoughan.com/2010/09/jaxb-xml-infoset-preservation.html
Looking forward to get a solution.
Thanks in advance.
Seb
Hello.
This problem still persists with version 2.5.2.
My setup is slightly different (using XMLElementWrapper with XmlElementRef), but it boils down to a comparable schema:
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="someRefA"/>
<xs:element ref="someRefB"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
what I try to achieve is:
- Parse the document (config file)
- unmarshall my domain object (using the Binder)
- change some values and
- save the file again, but keep the comments (and their relative positions to the nodes!).
Is there any fix for this problem yet?
Is there a better way to achieve my goal?
As this issue is quite old: is there any chance that this will be fixed some time in the near future?
Thanks in advance,
Andreas
Hi Andreas, Thank you for reminding us about this. We'll give a look. It looks like that this issue is quite complicated. :( Hi. For me it would also still be a big help, if it would be solved. Luckily comments are not used often, but it occurs. Would be great, if it would be taken up. Regards, Seb Hi Iaroslav, thanks for the quick response. I really appreciate your help. Unfortunately my configuration file will contain comments, so for me it is not acceptable to lose the proper ordering. It would be a pitty, if I had to apply some "dirty workaround"... Is there anything I can do, to increase the chances that this bug will finally be fixed after four years? Do you need a simplified example of my setup? regards, Andreas Hi Andreas, I think the problem is quite visible with a given info. The bug has P3 priority. So we will start to work on it as soon as we will have resources. Thanks. The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |