I'll try to at least provide a way you can do this with some handling code in beta 4.
- Dennis
Stephan Kozel wrote:
Hi everybody,
Has anyone worked with xsi:type attributes using jibx? I mean something like that:
XML document A <...> <data xsi:type="PassengerCarData"> <!-- car specific data --> </data> </...>
XML document B <...> <data xsi:type="ExtendedPassengerCarData"> <!-- extended passenger car specific data --> </data> </...>
In the binding.xml for jibx this would look something like that:
<mapping class="net.team.data.AbstractData" abstract="true">
<value name="type" ns="http://www.w3.org/2001/XMLSchema-instance" style="attribute" get-method="getXsiType" set-method="setXsiType"/>
</mapping>
<mapping name="data" class="net.team.data.PassengerCarData" extends="net.team.data.AbstractData">
<structure map-as="net.team.data.AbstractData">
<!-- passenger car specific bindings -->
</mapping>
<mapping name="data" class="net.team.data.ExtendedPassengerCarData" extends="net.team.data.PassengerCarData">
<structure map-as="net.team.data.AbstractData">
<!-- extended passenger car specific bindings -->
</mapping>
The point is, that I want to use the attributes and elements of the type PassengerCarData in the ExtendedPassengerCarData (as 'extended' indicates). But with a binding.xml like that above, this does not work, I get a NullPointerException at the end of the build:
BUILD FAILED: java.lang.NullPointerException
I don't understand how jibx should know, what "data" mapping it should use when reaching a <data xsi:type...> tag. I haven't found any way in the manual, how one can define a mapping according to the value of an attribute. Please proove me wrong !!!
If anyone knows a solution to this problem, please tell me!
cheers Stephan
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users
