Sam,
have you already had a look at the howto's at:
http://castor.codehaus.org/reference/html/XML%20data%20binding.html#d0e3173
As a general hint: if you marshal your entities you can tune your
mapping that the xml produced looks like the one you expect. In most
cases also unmarshaling of such an xml works with this mapping after
this. Having said that your xml may be one where this is not the case as
you have list/map elements on root of your xml.
Regards
Ralf
Sam-1234 schrieb:
Hi All-
Below is my response xml and necessary classes which I am using to get list
of claims
<response>
<person id="p1">
<address>
<state>NY</state>
</address>
</person>
<claim id="c1">
<policy>
<no>234</no>
<status>Y</status>
</policy>
</claim>
<claim id="c2">
<policy>
<no>234</no>
<status>Y</status>
</policy>
</claim>
<billing id="b1">
<stmt>
<stmtdetail ClaimID="c1">
<code>code1</code>
<Bcode>code11</Bcode>
</stmtdetail>
</stmt>
</billing>
<billing id="b2">
<stmt>
<stmtdetail ClaimID="c2">
<code>code1</code>
<Bcode>code2</Bcode>
</stmtdetail>
</stmt>
</billing>
</response>
My response class looks like below
Class Response{
Person person;
}
class Person
{
ArrayList<Claim> claims;
}
Class Claim
{
String no;
String status;
}
Issue is i am not able to get list of claims using mapping,i.e. it is null,
Is it due to the fact Claim object is nested?
My mapping to get arraylist,
<mapping>
<class name="Response">
<map-to xml="response"/>
<field name="person" type="Person">
<bind-xml name="person" location="reponse"/>
</class>
<class name="Person"><map-to xml="person"/>
<field name="claims" type="Claim" collection="arraylist">
<bind-xml="claim" node="element" location="response"/>
Ideally I would like to create is a Map of claim id="c1" as key and value of
'stmtdetail with ClaimID="c1", is it possible?
Any help is appreciated.
Thanks,
Sam
--
Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstraße 11
72127 Kusterdingen
Germany
Tel. +49 7071 3690 52
Mobil: +49 173 9630135
Fax +49 7071 3690 98
Internet: www.syscon.eu
E-Mail: [email protected]
Sitz der Gesellschaft: D-72127 Kusterdingen
Registereintrag: Amtsgericht Stuttgart, HRB 382295
Geschäftsleitung: Jens Joachim, Ralf Joachim
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email