Hi-
I need some advice regarding mapping.
Below is my demo xml
<response>
<life>
<liferesponse>
<id>12</id>
<Parent>
<Partner>
<person>
<firstname>A</firstname>
</person>
<address>
<line1>Addres 1</line1>
</address>
</Partner>
<Partner>
<person>
<firstname>B</firstname>
</person>
<address>
<line1>Add 1</line1>
</address>
</Partner>
</Parent>
</liferesponse>
</life>
</response>
My aim is to get a list of 'Partner' after unmarshalling.
<mapping>
<class name="com.Output">
<map to xml="Parent" />
<field name="results" type="com.PartnerResult" collections="arraylist">
<bind-xml name="Partner" node="element" />
</field>
<class name="com.PartnerResult">
<map to xml="Partner" />
<field name="firstname" type="string">
<bind-xml name="firstname" node="element" location="person" />
</class>
</mapping>
Can I map to 'Parent' directly into output without traversing thro'
response/life/liferesponse nodes ?
I did tried below
<class name="com.Output">
<map to xml="response" />
<field name="results" type="com.PartnerResult" collections="arraylist">
<bind-xml name="Partner" node="element"
location="life/liferesponse/Parent"
/>
with this, I am able to get a list size as 2 as per above example but value
of 'firstname' is null.
I would assume as 'Output' is mapped to root node 'response' and location
for arraylist is set as /Parent,
it may print value of first name.
Am I missing anything here?
Please advice.
Thanks,
Sam
--
View this message in context:
http://old.nabble.com/Question-about-mapping-tp27540709p27540709.html
Sent from the Castor - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email