Hi, not to my knowledge, as with this naming collision (two Java properties being mapped to one XML name), you are basically introducing ambiguity to your mapping.
I wonder, though, whether your requirement can be changed to reintroduce unambiguity to your mapping. Can you tell us a bit more about your use case ? Regards Werner Nimakwala, Mustufa wrote: > Hi Werner, > > Thanks for your instant reply. > > You got my problem exactly. > Is there any sub way to execute this kind of stuff? > > Your immediate reply is really appreciated. > > Regards > Mustafa > > > > -----Original Message----- > From: Werner Guttmann [mailto:[email protected]] > Sent: Tuesday, January 20, 2009 5:00 PM > To: [email protected] > Subject: Re: [castor-user] Having Problem with Castor > > Hi, > > the problem with your approach is as follows: within the (class) mapping > for com.SYNCord.AL3.CUSTOM you are defining two collections (for > com.SYNCord.AL3.Bis5 and com.SYNCord.AL3.Bpi5), which you map to the > same XML artefact name (InsuranceSvcRq/Pers). And that's exactly your > problem. as you are mapping two field members to one XML name only. > > In my view, that is not an option, and (most likely) this is what's > causing problems. > > Regards > Werner > > Nimakwala, Mustufa wrote: >> Hi, >> >> >> >> I am using castor mapping file for binding xml with java objects. >> >> >> >> My business requirement is: >> >> I need to map Xml element to any field of java object. >> >> For that I have used location attribute in bind-xml of mapping file. >> >> But for the very first bind it will map element with java object and >> castor will not map for second time. >> >> >> >> Problem: >> >> Element A1 of YY node, element b1 of AA node has to unmarshall into > Bis5 >> object >> >> And element b1 of YY node, element c1 of AA node has to unmarshall > into >> Bpi5 object. >> >> >> >> For example: >> >> >> >> XML file: >> >> <?xml version="1.0" encoding="UTF-8"?> >> >> <ACORD> >> >> <InsuranceSvcRq> >> >> <Pers> >> >> <zz> >> >> <YY> >> >> <a1>testData1</a1> >> >> <b1>testData2</b1> >> >> </YY> >> >> </zz> >> >> <AA> >> >> <b1>testData3</b1> >> >> <c1>testData4</c1> >> >> </AA> >> >> </Pers> >> >> </InsuranceSvcRq> >> >> </ACORD> >> >> >> >> Mapping file: >> >> <? xml version="1.0"?> >> >> <! DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Object Mapping DTD Version >> 1.0//EN" "http://castor.exolab.org/mapping.dtd"> >> >> <mapping> >> >> <description>A mapping file used for unmarshalling and >> marshalling</description> >> >> >> >> <class name="com.SYNCord.AL3.CUSTOM"> >> >> <map-to xml="ACORD" /> >> >> >> >> <field name="bis5" type="com.SYNCord.AL3.Bis5" >> collection="collection"> >> >> <bind-xml name="Pers" location="InsuranceSvcRq" /> >> >> </field> >> >> >> >> <field name="bpi5" type="com.SYNCord.AL3.Bpi5" >> collection="collection"> >> >> <bind-xml name="Pers" location="InsuranceSvcRq" /> >> >> </field> >> >> >> >> </class> >> >> >> >> <class name="com.SYNCord.AL3.Bis5"> >> >> <field name="tag1" type="java.lang.String"> >> >> <bind-xml name="a1" location="zz/YY"/> >> >> </field> >> >> <field name="tag2" type="java.lang.String"> >> >> <bind-xml name="b1" location="AA"/> >> >> </field> >> >> </class> >> >> >> >> <class name="com.SYNCord.AL3.Bpi5"> >> >> <field name="tag1" type="java.lang.String"> >> >> <bind-xml name="b1" location="zz/YY"/> >> >> </field> >> >> <field name="tag2" type="java.lang.String"> >> >> <bind-xml name="c1" location="AA"/> >> >> </field> >> >> </class> >> >> >> >> </mapping> >> >> >> >> Output Xml: >> >> <CUSTOM> >> >> <bis5> >> >> <tag2>testData3</tag2> >> >> <tag1>testData1</tag1> >> >> </bis5> >> >> </CUSTOM> >> >> >> >> But according to mapping file actual output file that I am expecting > is >> as below: >> >> Expected Output Xml: >> >> <?xml version="1.0" encoding="UTF-8"?> >> >> <CUSTOM> >> >> <bpi5> >> >> <tag2>testData4</tag2> >> >> <tag1>testData2</tag1> >> >> </bpi5> >> >> <bis5> >> >> <tag2>testData3</tag2> >> >> <tag1>testData1</tag1> >> >> </bis5> >> >> </CUSTOM> >> >> >> >> My question is what changes I have to make in my Mapping file so that > I >> will get <bpi5> element (marked as red in expected output Xml)? >> >> >> >> It will help a lot if any solution will be given to this problem. >> >> >> >> Regards, >> >> >> >> Mustafa Nimakwala >> >> Nortal - 0202 3872, Cell - 9823127867 >> >> >> >> >> Confidential: This electronic message and all contents contain > information from Syntel, Inc. which may be privileged, confidential or > otherwise protected from disclosure. The information is intended to be > for the addressee only. If you are not the addressee, any disclosure, > copy, distribution or use of the contents of this message is prohibited. > If you have received this electronic message in error, please notify the > sender immediately and destroy the original message and all copies. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > > Confidential: This electronic message and all contents contain information > from Syntel, Inc. which may be privileged, confidential or otherwise > protected from disclosure. The information is intended to be for the > addressee only. If you are not the addressee, any disclosure, copy, > distribution or use of the contents of this message is prohibited. If you > have received this electronic message in error, please notify the sender > immediately and destroy the original message and all copies. > > Confidential: This electronic message and all contents contain information > from Syntel, Inc. which may be privileged, confidential or otherwise > protected from disclosure. The information is intended to be for the > addressee only. If you are not the addressee, any disclosure, copy, > distribution or use of the contents of this message is prohibited. If you > have received this electronic message in error, please notify the sender > immediately and destroy the original message and all copies. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

