structure mapping with all values optional does is unmarshalled as null when 
none of the values is defined (in context of an collection)
----------------------------------------------------------------------------------------------------------------------------------------

         Key: JIBX-86
         URL: http://jira.codehaus.org/browse/JIBX-86
     Project: JiBX
        Type: Bug
  Components: core  
    Versions: 1.0-RC0    
 Environment: windows, linux
    Reporter: Dominik Wei-Fieg
 Attachments: example.zip

Hi *, 

I am experiencing problems when I try to bind structures in collections where 
all attributes the structure defines are optional, e. g. 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE binding SYSTEM "binding.dtd">
<binding>
        <mapping name="outer" class="com.ars_subtilior.test.jibx.Outer">
                <value name="name" field="name" usage="optional" 
style="attribute"/>
                <collection 
factory="com.ars_subtilior.test.jibx.Outer.createCollection"
                        field="items" usage="optional" ordered="false">
                        <structure name="inner" 
type="com.ars_subtilior.test.jibx.Inner" 
                                value-style="attribute" usage="optional">
                                <value name="name" usage="optional" 
field="name"/>
                                <value name="i" usage="optional" field="i" 
default="0"/>
                                <value name="woop" usage="optional" 
field="woop"/>
                        </structure>
                </collection>
        </mapping>
</binding>

When I unmarshal a xml file like the following:

<?xml version="1.0"?>
<outer name="outerName">
        <inner name="innerName"/>
        <inner/>
</outer>

only one Inner gets created but the collection (Outer.items) contains two 
entries, the first one is the Inner that got created for <inner 
name="innerName"/>, the second one is null.

I have attached a zip file that contains everything that is needed to reproduce 
the behaviour (it is an Eclipse project [sorry for naming it jibx_error]).
The problem arises with RC 0 and RC 1.

Thanks, 
--
Dominik


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to