Your binding sample doesn't appear to match your description (or the error message). The error says you have a situation where a structure containing unordered elements is optional. This is a case that the current code generation can't handle (and future versions probably won't, either). The problem is that with unordered elements JiBX doesn't know which element to look for to decide if the optional structure really is present or not. Does that match your actual situation?

In other words, you have a binding along these lines:

<structure name="a" field="a">
 <value name="b" field="b" usage="optional"/>
 <value name="c" field="c" usage="optional"/>
 <structure field="d" usage="optional" ordered="false">
   <value name="e" field="e" usage="optional"/>
   <value name="f" field="f" usage="optional"/>
 </structure>
</structure>

The problem here is that when the code starts parsing the content of the <a> element of a document, it would actually need to check for a "b" element (handled directly), a "c" element (handled directly), an "e" element (handled as part of the embedded structure), or an "f" element (handled as part of the embedded structure). This gets too messy to be worthwhile, so JiBX only let's you do this if you supply a wrapper element for the embedded structure in this case - that way it can check if the element is present directly, without having to dig down into the child structure.

In general I try to make sure JiBX can handle anything that can be represented by a W3C XML Schema definition (and perhaps some things that can't). I seem to remember this case can't be represented by a schema definition, though I haven't checked it to make sure.

 - Dennis

Thomas Behrends wrote:

Hi!

I'm trying to bind my existing XML-files with JIBX. Because the old files don't need to be ordered, the JIBX-configuration needs ordered="false" for the mapping. But when trying to configure unordered elements and collections together, I get the error message "Internal error - content not ordered".

Here's one example:

<binding>
<mapping name="info" class="de.instantolap.ws.xml.info.InfoType">
<value style="attribute" usage="optional" name="logo" field="logo"/>
<value usage="optional" name="title" field="title"/>
<value usage="optional" name="description" field="description"/>
<collection field="defaults" usage="optional" item-type="de.instantolap.ws.xml.info.DefaultType"/>
</mapping>


   <mapping name="default" class="de.instantolap.ws.xml.info.DefaultType">
       <value style="attribute" usage="optional" name="role" field="role"/>
       <value style="attribute" usage="optional" name="user" field="user"/>
       <value style="text" usage="optional" field="url"/>
   </mapping>
</binding>

Anything I did wrong?

Best regards,
tom






-------------------------------------------------------
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