|
I have been using Castor Mapping with a mapping file. The structure of our XML documents do not map to our Java Classes directly in all cases. So far, the mapping file has worked for our data mapping implementation. This scenario occurs a lot and I am looking for the best solution for mapping this case.
The XML file has is more "nested". For example:
<Person> <IdentificationCode> <IdValue name="SocialSecurityNumber">536403123</IdValue> </IdentificationCode> <PersonName> <GivenName>Joe</GivenName> <FamilyName>Thompson</FamilyName> </PersonName> <Person>
The Java class is "flatter". In this case:
public class Person implements IPerson {
private String firstName; private String lastName; private String ssn;
public String getFirstName() { return firstName; }
public void setFirstName(String firstName) { this.firstName = firstName; }
public String getLastName() { return lastName; }
public void setLastName(String lastName) { this.lastName = lastName; }
public String getSSN() { return ssn; } public void setSSN(String ssn) { this.ssn = ssn; }
}
I need to map :
Person/IdentificationCode/IdValue to Person.ssn Person/PersonName/GivenName to Person.firstName Person/PersonName/Family to Person.lastName
What is the best solution for this, keeping in mind that this occurs a lot in our code?
I appreciate your help.
Christine |
