Community
Participate
Working Groups
Build Identifier: eclipselink-2.0.2.v20100323-r6872 For an xml structure like this, when i declare the schema context of the object EMPLRecords as EMPL_Records and subsequently map the child element EMPL_FIRST_NAME to an attribute of EMPLRecords object by defining the xpath as EMPL_INFO/EMPL_FIRST_NAME/text(), the values are not set when the xml was unmarshalled to the java object. This used to work in version 1.1.4. <EMPL_RECORDS> <EMPL_NUM>123456</EMPL_NUM> <EMPLINFO> <EMPL_FIRST_NAME>XYZ</EMPL_FIRST_NAME> <EMPL_LAST_NAME>ABC</EMPL_LAST_NAME> </EMPLINFO> </EMPL_RECORDS> Reproducible: Always Steps to Reproduce: 1.Use an xsd to map EMPLRecords object in the workbench 2.set the jaxb.properties context to javax.xml.bind.context.factory = org.eclipse.persistence.jaxb.JAXBContextFactory 3.Try to unmarshall the XML file to EMPLRecords object. The first name and last name properties are not populated with values.
Please provide the Schema and EMPLRecords class for debugging. Additional Information would be helpful: -Which API are you using to create your context -Which API is being called to Unmarshal the XML -Is there a sessions.xml file on your classpath? If so, please provide this sessions.xml -Was project deployment xml generated from the mapping workbench? If so, please provide this project.xml -Are any error messages or warning logged to the console during context creation? Also in your description, you say that the mapped XPATH is EMPL_INFO/EMPL_FIRST_NAME/text() however in the provided instance doc EMPLINFO doesn't contain an underscore. Double check your xpaths vs your instance doc to make sure that this is correct.
Matt thanks for the prompt reply. That was just an example I provided to illustrate the issue. The EMPL_INFO was a typo. I will update you with all all the information soon. The actual schema structure and the class files that I am dealing with is huge. I will try to provide a test that fails and will provide you with the results as soon as possible. Thanks Raj (In reply to comment #1) > Please provide the Schema and EMPLRecords class for debugging. > > Additional Information would be helpful: > > -Which API are you using to create your context > -Which API is being called to Unmarshal the XML > -Is there a sessions.xml file on your classpath? If so, please provide this > sessions.xml > -Was project deployment xml generated from the mapping workbench? If so, please > provide this project.xml > -Are any error messages or warning logged to the console during context > creation? > > Also in your description, you say that the mapped XPATH is > EMPL_INFO/EMPL_FIRST_NAME/text() however in the provided instance doc EMPLINFO > doesn't contain an underscore. Double check your xpaths vs your instance doc to > make sure that this is correct.
Created attachment 169395 [details] Sessions.xml file
The attached sessions.xml file is incomplete. It's missing the </sessions> closing tag. Without this it's possible that EclipseLink JAXB isn't loading your mapping meta-data and is instead attempting to use JAXB defaults.
Changing target to 2.1.1: We have been unable to recreate the issue. Currently Matt is waiting on more information from Raj on this issue.
I believe this problem was related to bug 318357 which was causing some Direct Mappings to fail to correctly unmarshal if there were unmapped elements in the instance document. A fix for that bug has been checked into SVN in the 2.1 and Trunk streams and will start appearing in the nightly builds. I'm closing this bug as a duplicate of 318357. If this issue persists even with the fix for that bug, please re-open and provide more details to reproduce. -Matt *** This bug has been marked as a duplicate of bug 318357 ***
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink