Hi Jeff, You could perhaps do this using set-method rather than field, where you have multiple set-methods for the different possible cases (which all end up storing to the same field). However, your best bet is probably to write a simple custom unmarshaller to handle this case. That's a little more work, but gives you the flexibility to build in code to handle the different possible cases cleanly. See http://jibx.sourceforge.net/tutorial/binding-custom.html#marunmar for a starting point.
- Dennis Dennis M. Sosnoski SOA, Web Services, and XML Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-296-6194 - Wellington, NZ +64-4-298-6117 [EMAIL PROTECTED] wrote: > Thanks. Unfortunately case 1 is pretty popular. :-( What is this > xsi:type that you referred to? Is there any way I can just create a > "hack" and have whatever is a child of <a> be unmarshalled into an > object x? Then in object x I could examine to see which of the three > cases applied? > > ------------------------------------------------------------------------ > *From:* [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > *Sent:* Tuesday, August 15, 2006 11:27 AM > *To:* Krasky, Jeffrey (West) > *Subject:* Re: [jibx-users] Confused on how to bind > > > Hi, > > I think you have to use something related to xsi:type in this case > since > structurally *a* in case 1 is radically different from case 3 or > case 2. > also if you had only 2 possibilities (only case 2 or case 3) i > would have suggested you to use optional as in > > <value name="*b*" field="*b*" usage="optional"/> > the optional tag ensures that jibx iwll not complain if *b* is > missing > > sorry i can't be of much help.but if you think case 1 will never > arise then you could try using the usage="optional" . > > Regards, > Chetan > > > > > > *<[EMAIL PROTECTED]>* > Sent by: [EMAIL PROTECTED] > > 15/08/2006 17:05 > Please respond to JiBX users > > > To: <jibx-users@lists.sourceforge.net> > cc: > Subject: [jibx-users] Confused on how to bind > > > > > Hi, > I have an XML file that can appear in one of three ways: > > 1) <a> > <b> > <c>some text</c> > </b> > </a> > > 2) <a> > <b>some text</b> > </a> > > 3) <a> > <c>some text</c> > </a> > > As you can see, "some text" can appear between either the <b> or > the <c> tags. I think the major hangup is the possibility that > the <c> tag can appear as a child of EITHER <a> or <b>. > > Is something like this even possible to bind? If so, can someone > give me a sketch of the binding code? I am writing/rewriting it > as I keep getting confused.... Really, all I care about is the > "some text" part. Nothing else is of importance to me. > > > Thanks, > > > > > > Jeff------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642_______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > > ------------------------------------------------------------------------ > > > This transmission may contain information that is privileged, > confidential, legally privileged, and/or exempt from disclosure > under applicable law. If you are not the intended recipient, you > are hereby notified that any disclosure, copying, distribution, or > use of the information contained herein (including any reliance > thereon) is STRICTLY PROHIBITED. Although this transmission and > any attachments are believed to be free of any virus or other > defect that might affect any computer system into which it is > received and opened, it is the responsibility of the recipient to > ensure that it is virus free and no responsibility is accepted by > JPMorgan Chase & Co., its subsidiaries and affiliates, as > applicable, for any loss or damage arising in any way from its use. > If you received this transmission in error, please immediately > contact the sender and destroy the material in its entirety, > whether in electronic or hard copy format. Thank you. > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > ------------------------------------------------------------------------ > > _______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users