The requirement in Castor to develop a XML with the Complex Type as shown below
<SimplDataEntry>
<Envlp>
<FirstName>XXX</FirstName>
</Envlp>
</SimplDataEntry>
<SimplDataEntry>
<Envlp>
<LastName>XXX</LastName>
</Envlp>
</SimplDataEntry>
What would be the JAVA representation for the above Requirement. I tried with arrayList but the problem here is After ENVLP the subtype is not constant its getting changed.
I am getting like below structure when I designed it as an ArrayList.
Castor.xml
<field name="firstName" collection="arraylist" type="java.lang.String">
<bind-xml name="FirstName" location="SplmtryData/Envlp"/>
</field>
<field name="LastName" collection="arraylist" type="java.lang.String">
<bind-xml name="LastName" location="SplmtryData/Envlp"/>
</field>
OutPut
--------
<SimplDataEntry>
<Envlp>
<FirstName>XXX</FirstName>
<LastName>XXX</LastName>
</Envlp>
</SimplDataEntry>
No comments:
Post a Comment