Hi Harrie,

You can use ordered="false" to get this behavior, which requires all the child binding components to be optional. See http://jibx.sourceforge.net/tutorial/binding-extras.html#mixing This does have the drawback of meaning you lose the automatic validation by JiBX that required items are present, though. An unordered version of your binding would be:

<binding>
 <mapping name="COMP" class="COMP" ordered="false">
   <value name="FOO" field="FOO" usage="optional"/>
   <value name="BAR" field="BAR" usage="optional"/>
   <value name="OTHER" field="OTHER" usage="optional"/>
 </mapping>
</binding>

If you just want to make <FOO/> and <BAR/> unordered (as opposed to all the child components), you can instead do this:

<binding>
 <mapping name="COMP" class="COMP">
   <structure ordered="false">
     <value name="FOO" field="FOO" usage="optional"/>
     <value name="BAR" field="BAR" usage="optional"/>
   </structure>
   <value name="OTHER" field="OTHER"/>
 </mapping>
</binding>

This isn't actually allowed according to the <structure> documentation, but I just tried it and confirms that it works - I need to update the <structure> documentation, I missed changing it when I implemented this some time ago.

 - Dennis

Harrie Hazewinkel wrote:

HI,

Reading through the tutorials I cannot find any reference
order of the fields. My problem is that I am not sure
(depending on the device) of the order of elements and
as it looks to me one device provides the elements in
the wrong order.

Is there such a possibility to specify in the binding.xml
that the XML data stream may have a different order.


If not I was wondering if the folloowing is allowed practise with JIBX.

Order A
<COMP>
<FOO/>
<BAR/>
<OTHER>dtata</OTHER>
</COMP>


Order B <COMP> <BAR/> <FOO/> <OTHER>dtata</OTHER> </COMP>


binding.xml <binding> <mapping name="COMP" class="COMP"> <value name="FOO" field="FOO" usage="optional"/> <value name="BAR" field="BAR" usage="optional"/> <value name="FOO" field="FOO" usage="optional"/> <value name="OTHER" field="OTHER"/> </mapping> </binding>


I understand it is dangerous and would allow FOO twice, but it may also be parser error (although it seem to create the classes OK).


thanks by advance,


Harrie




-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to