Markus Meyer wrote:
> Thomas,
>
> Thomas Jones-Low schrieb:
>> In the <mapping class="AbstractCommand"> there is a <structure
>> field="credential">, you need to add either a name or a map-as to this
>> this tag.
>>
> thanks for the pointer. Unfortunately, your suggestions did not work.
> Infact, Jibx does not seem to need the name or map-as because the
> mapping from the field name to the type is done using the java source.
> Infact, looking through the "binding.xml" file, there are relatively few
> "name" tags at all, and most seem to be infered automatically.
>
> I found, however, another interesting behaviour. When I put the "Cred"
> tag before the "Data" tag (i.e. next to the "CmdID") tag, the data is
> read in properly, like this:
>
> <Alert><CmdID>2</CmdID><Cred/><Data>201</Data></Alert>
>
> When I put the "Cred" tag _after_ "Data", the XML fails to read:
>
> <Alert><CmdID>2</CmdID><Data>201</Data><Cred/></Alert>
>
> Looking at the "binding.xml" file, we see this:
>
> 88 <mapping class="com.funambol.framework.core.AbstractCommand"
> abstract="true" ordered="false">
> 89 <structure name="CmdID" field="cmdID" usage="optional">
> 90 <value field="cmdID" style="text"/>
> 91 </structure>
> 92 <value name="NoResp" field="noResp" format="formatBoolean"
> usage="optional"/>
> 93 <structure field="credential" usage="optional"/>
> 94 </mapping>
> ...
> 102 <mapping name="Alert" class="com.funambol.framework.core.Alert"
> extends="com.funambol.framework.core.AbstractCommand" ordered="false">
> 103 <structure
> map-as="com.funambol.framework.core.AbstractCommand" usage="optional"/>
> 104 <value name="Data" field="data" usage="optional"/>
> 105 <value name="Correlator" field="correlator"
> usage="optional"/>
> 106 <collection field="items"
> item-type="com.funambol.framework.core.Item" usage="optional"/>
> 107 </mapping>
>
> It seems that although for both classes "ordered=false" is set, Jibx
> first wants to read all tags within the base class AbstractCommand
> (namely "CmdID" and "Cred", then goes on to read the Alert class' tags
> (namely "Data"). If we put the "Data" between the "CmdID" and "Cred" it
> is confused and throws the error.
>
> Is this the expected behaviour of Jibx? Is there a workaround (other
> than giving up the hierarchical classes)?
>
>
This is something to try: Try removing line 103.
What your mapping says is: All of the AbstractCommand fields (in any
order) and then the Data, Correlator fields (in any order). But the
AbstractCommand fields are a single structure, and must be grouped
together.
The <mapping extended=""> automatically includes the fields from the
extended class, there isn't any reason to repeat structure in the Alert
mapping.
--
Thomas Jones-Low Softstart Services Inc.
[EMAIL PROTECTED] JobScheduler for Oracle
Ph: 802-398-1012 http://www.softstart.com
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users