That's obviously not as convenient as having JiBX just do it for you directly, and it's possible the binding definition could be extended to represent this. It's a pretty uncommon requirement, though.
If you find this comment useful and try it out I'd appreciate it if you could also add it to the Wiki. For what it's worth I think I've made it a little easier to use, with some basic instructions on the form to add or edit a snip.
- Dennis
Tilman Linden wrote:
hello again,
i wonder if there is a possibility to access the element stack inside of a binding definition, just like you can do inside a Custom Marshaller using getStackObject(...).
assume the following scenario:
class A { String a_name; B b; C c; }
class B { String b_name; }
class C { String c_name; }
shall be marshalled to the following XML:
<A name="a_name"> <B name="b_name"> <C name="c_name"/> </B> </A>
the following mapping should describe the problem:
<mapping name="A" class="A"> <value style="attribute" field="a_name"/> <structure name="B" field="b"> <value style="attribute" field="b_name"/> <structure name="C" field= ?HOW TO ACCESS A.c AT THIS POINT? > <value style="attribute" field="c_name"/> </structure> </structure> </mapping>
maybe it is just bad design trying to map a flat object structure to a
nested XML structure, but i encountered this problem quite a few times. if i overlooked a simple solution for this, maybe someone can point me
at it. i would like to avoid custom marshallers because then the mapping
semantics are split across the binding and the marshaller.
regards,
Tilman
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users
