Community
Participate
Working Groups
This extension will allow the following XML document: <?xml version="1.0" encoding="UTF-8"?> <customer> <name type="FIRST">Jane</name> <name type="LAST">Doe</name> <address type="BILLING"/> <address type="SHIPPING"/> </customer> To be mapped to the following class: package conditional; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.eclipse.persistence.oxm.annotations.XmlPath; @XmlRootElement @XmlType(propOrder={"firstName", "lastName", "billingAddress", "shippingAddress"}) @XmlAccessorType(XmlAccessType.FIELD) public class Customer { @XmlPath("name[@type=FIRST]/text()") private String firstName; @XmlPath("name[@type=LAST]/text()") private String lastName; @XmlPath("address[@type=BILLING]") private Address billingAddress; @XmlPath("address[@type=SHIPPING]") private Address shippingAddress; } This is through adding support for predicates (the part between the square brackets) to MOXy's XPath based mapping.
Created attachment 190928 [details] Core - Fix
Created attachment 190934 [details] Core - Fix
Created attachment 191001 [details] Core - Fix Updated to include support for namespaces.
Created attachment 191149 [details] MOXy - Test Cases
Created attachment 191150 [details] Core - Fix
Created attachment 191167 [details] MOXy - Test Cases
Created attachment 191168 [details] Core - Fix
Created attachment 191249 [details] MOXy - Test Cases
Created attachment 191250 [details] Core - Fix
Created attachment 191449 [details] MOXy - Test Cases
Created attachment 191450 [details] Core - Fix
Created attachment 191545 [details] MOXy - Test Cases
Created attachment 191546 [details] Core - Fix
Created attachment 191547 [details] MOXy - Fix
CORE CHANGES XPathPredicate - New class. This class represents the [@foo='bar] portion of the XPath. It has two properties, one to store the XPath portion and the other to hold the value. XPathFragment - Now can hold onto an XPathPredicate. XMLField - Has code to cause the XPathPredicate to be initialized. *NodeValue - Causes the predicate to be written when appropriate. MarshalRecord - Added a new method predicateAttribute which is responsible for writing the predicate attribute if one was specified. UnmarshalRecord - Now leverages the predicate if one is available. This is done the same way as for positional nodes. --- MOXy CHANGES AnnotationsProcessor - Added JoinNode and JoinNodes to the list of annotations that should be looked for to determine if a property has been mapped. - Fixed an "is attribute" check. MappingsGenerator - Fixed an issue where the schema type was not being set to QName if the mapping was configured with @XmlPath.
Fix checked into trunk at rev: 9140 Code reviewed by: Matt MacIvor
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink