Hi John,
It'll be a little kludgey, since what you want to do is outside the
envelope, but you should still be able to do it by using nested
structures. Take the ordered="false" attribute off the <mapping> and
keep only the attributes of the SCANDTN element. Make your dummy fields
*attribute*s and include them directly under the <mapping>. Then add a
nested <structure ordered="false"> element around all the unordered
child elements of SCANDTN.
- Dennis
Pensock, John wrote:
Hi all,
The POJO that I want to unmarshal XML into contains additional fields
that I want to populate with fixed values. When I try something like:
<mapping name="SCANDTN" ordered="false" class="O_x_class"
pre-set="clear_All">
<value name="version" field="version_num" style="attribute"
usage="optional"/>
<value name="dummy1" field="eyecatcher" usage="optional"
default="XMLReply"/>
...
<value name="MSGID" field="message_id" usage="optional"/>
...
</mapping>
where the ‘dummy1’ field is one of these fields (and ‘MSGID’ is a
real, expected XML tag), the field (in this case ‘eyecatcher’) gets
set to null and not the default that I want of ‘XMLReply’.
If I change the ‘ordered’ field to ‘true’ in <mapping> then in this
case ‘eyecatcher’ does get set to ‘XMLReply’ which is what I want.
Is this expected behavior? Is there a way to have an unordered set of
XML tags and unmarshall them with default values (as I have no control
over order of the XML tags the sender is creating)??
Thanks for any assistance.
My first use of the product and I am liking it a lot.
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users