I have a scenario where I need to handle xml data that will parsed into object. Requirement is to dynamically map those variables. For example suppose I have an xml :
<request>
<member>
<id>abc</id>
<details>
<ssn>19</ssn>
<verification>
<indicator>Y</indicator>
<fedInd>N</fedInd>
<status>XY</status>
</verification>
</details>
<taxStatus>
<LastYrStatus>NFT</LastYrStatus>
<ThisYrStatus>MFT</ThisYrStatus>
</taxStatus>
</member>
</request>
Now looking at the xml I want to map the field indicator whose exact path is : request|member|details|verification|indicator the dynamic mapping should give me the getter of these variables from respective java object like getRequest().getMember().getDetails().getVerification().getIndicator() so that if in future path of xml tag got change I don't have to make so many changes in the code it will be dynamically mapped with the new tag location.
Can anyone reply how to handle this situation using java reflection or through any other way.
XML are based on xsds, why don't you provide XSDs for parsing, so that whenever the XSD is changed the data accordingly provided.