Another problem is that you've got ordered="false" on your mapping for subAdress, with two child elements both named "number". That probably should be checked as an error by JiBX, but if you think about it you should see that there's no way the runtime can tell which <number> element is which. Generally you should stay with the default of ordered="true" unless you really need unordered elements.
- Dennis
reto mueller wrote:
Hi,
I’m trying to write a binding that uses the org.jibx.extras.TypedArrayMapper to marshall/unmarshall an array of objects. The binding compiles OK when having the binding defined like this:
<binding>
<mapping class="jibxtest.Person" name="person"
ordered="false" >
<value name="personNumber" field="personNumber"
usage="optional"/>
<structure field="adresses" usage="optional"/>
</mapping>
<mapping class="jibxtest.Adress" abstract="true"
ordered="false" >
<value name="number" field="number" usage="optional"/>
</mapping>
<mapping class="jibxtest.Adress[]" name="adresses"
marshaller="org.jibx.extras.TypedArrayMapper"
unmarshaller="org.jibx.extras.TypedArrayMapper" />
<mapping class="jibxtest.SubAdress" name="subAdress"
ordered="false" extends="jibxtest.Adress">
<structure map-as="jibxtest.Adress"
usage="optional"/>
<value name="number" field="subNumber" usage="optional"/>
</mapping>
</binding>
While Adress is an superclass of subAdress and the Person contains an Array of adresses. At rutime I add subAdress objects to the Adrdess Array. Marshalling works but when I unmarshall the following xml:
<?xml version="1.0" encoding="UTF-8"?> <person> <personNumber>personNumber</personNumber> <subAdress> <number>4</number> <number>subNumber1</number> </subAdress> </person>
I get an the following exception:
org.jibx.runtime.JiBXException: Expected end tag,
found start tag "number"
Unmarshalling works too when I add <addresses> tags around the <subadress> by hand - but this is not a solution!
does anyone have experience with the TypedArrayMapper
and is able to help?
------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php _______________________________________________ jibx-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jibx-users
