I have an XML which needs to be mapped to a Java object i.e. a DTO. My XML has some wrapper elements which don't have any java objects in my DTO.. my XML looks something like this
<UseCaseView>
<FindCandidates>
<CandidatesRequest>
<APIRequest>
<Code>Code</Code>
</APIRequest>
</CandidatesRequest>
</FindCandidates> </UseCaseView>
The "FindCandidates" and "CandidatesRequest" are just wrapper elements and "APIRequest" is again a DTO..
I am using XMLPath like this in my DTO.. My Dto looks like this..
@XmlRootElement(name = "UseCaseView")
public class FindRequestDTO implements Serializable{
private static final long serialVersionUID = 5528726225975606325L;
private ApiRequestDTO apiRequest;
@XmlPath("FindCandidates/CandidatesRequest/APIRequest")
public ApiRequestDTO getAPIRequest() {
return apiRequest;
.........
This is not mapping the APIRequest element to my ApiRequestDTO, if I remove the two wrapper elements and map directly using XMLElement(name = "APIRequest") it works... But I need to ignore the two wrapper elements and construct my DTO.. I have added the Jaxb.properties file with
"javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory"
in my resources folder.
can someone help me to know whats going wrong here..
thanks,