Community
Participate
Working Groups
Given the following class: import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import org.eclipse.persistence.oxm.annotations.XmlMarshalNullRepresentation; import org.eclipse.persistence.oxm.annotations.XmlNullPolicy; @XmlRootElement(name="RootEntity") public class RootEntity { @XmlElement(name="EntityOne") @XmlNullPolicy(emptyNodeRepresentsNull=true, nullRepresentationForXml=XmlMarshalNullRepresentation.EMPTY_NODE) public Entity entityOne; @XmlElement(name="EntityTwo") @XmlNullPolicy(emptyNodeRepresentsNull=true, nullRepresentationForXml=XmlMarshalNullRepresentation.EMPTY_NODE) public Entity entityTwo; } And the following XML: <RootEntity> <EntityOne id="objectID"/> <EntityTwo /> </RootEntity> The corresponding object unmarshalled should have the entityOne property set to an instance of Entity, and entityTwo set to null. Currently both are set to null. This only happens if there are no sub-elements.
Created attachment 176279 [details] Core - Fix
Created attachment 176349 [details] Core - Fix
Created attachment 176357 [details] MOXy - Test Cases
Created attachment 176370 [details] Core - Fix
Created attachment 176371 [details] MOXy - Test Cases
Created attachment 176379 [details] Core - Fix
Created attachment 176380 [details] MOXy - Test Cases
Added a new event to DeferredContentHandler called processEmptyElementWithAttributes(). By default this just calls processEmptyElement. This is overridden in CompositeObjectMappingContentHandler where it is treated as processComplexElement(). The processEmptyElementWithAttributes event is called when there are no sub-elements or characters and atleast one attribute that is not a namespace declaration or in the xsi namespace. Code checked into trunk at rev: 8026 Code reviewed by: Matt MacIvor
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink