Is there a way to map across XML nodes into a single object.
I have the following XML snippet:
<BrnchOfc brnchPK="" NYSEBrnchCdNb="XXX-XXXX" bllngCd=""
brnchPhone="XXX" brnchFax="XXX" prvtRsdnc="N">
<Addr strt1="BUILDING ADDRESS" strt2="15TH FLOOR" city="NEW
YORK" state="NY" cntry="USA" postlCd="10005">
</Addr>
And I have a BranchOffice Object and a ContactInfo object which is
contained in the Branch Office Object.
The ContactInfo includes information on the Address, Phone, and Fax.
Also, the ContactInfo is shared by several other classes, but they only
contain an address.
I have been able to get the Unmarshaller to create the ContactInfo
object with either the Phone/Fax or the Address but not both.
Is there a way to map up to a parent node? So in my contact info
mapping, say these 2 fields belong to the parent node? Kinda like the
location attribute, but in reverse?
<class name="com.reged.datatrax.castor.BranchOffice">
<map-to xml="BrnchOfc"/>
<field name="branchCrd" type="integer">
<bind-xml name="brnchPK" node="attribute"/>
</field>
<field name="nyseBranchCode" type="string">
<bind-xml name="NYSEBrnchCdNb" node="attribute"/>
</field>
<field name="billingCode" type="string">
<bind-xml name="bllngCd" node="attribute"/>
</field>
<field name="contactInfo"
type="com.reged.common.ContactInfo" container="true"/>
</class>
<class name="com.reged.common.ContactInfo">
<field name="phone" type="string">
<bind-xml name="brnchPhone"/>
</field>
<field name="fax" type="string">
<bind-xml name="brnchFax"/>
</field>
<field name="address1" type="string">
<bind-xml name="strt1" node="attribute"/>
</field>
<field name="address2" type="string">
<bind-xml name="strt2" node="attribute"/>
</field>
<field name="city" type="string">
<bind-xml name="city" node="attribute"/>
</field>
<field name="state" type="string">
<bind-xml name="state" node="attribute"/>
</field>
<field name="country" type="string">
<bind-xml name="cntry" node="attribute"/>
</field>
<field name="zip" type="string">
<bind-xml name="postlCd" node="attribute"/>
</field>
</class>