Hello,
for my project I'm doing the unmarshalling from XML to objects (I don't
need to do the marshalling). In the XML I have to unmarshall there is one tag
that must be mapped to two different objects depending on a value that is
located before in the same XML. My problem is how to define the mapping to say
that one tag can be mapped to two different objects.
Example of the XML:
<response>
<rule>
....
</rule>
</response>
For other reasons I
made a custom unmarshaller for the tag <response> and inside it I call
if
(valuePreviouslyParsed == 1) {
ctx.unmarshalElement(RuleA.class);
}
else {
ctx.unmarshalElement(RuleB.class);
}
where RuleA and RuleB are two objects
that are represented in XML by the same tag <rule>.
In the binding file I've
tried to put the following:
<binding direction="input">
...
<!-- RULE A -->
<mapping name="rule" class="RuleA" >
....
</mapping>
<!--
RULE B -->
<mapping name="rule" class="RuleB" >
....
</mapping>
</binding>
At compilation time I do not get any error, but at runtime only the
first mapping is considered and hence I always get back a RuleA object.
How
could I fix this problem?
Thanks.
Denis
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users