[ 
http://jira.codehaus.org/browse/JIBX-231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=146282#action_146282
 ] 

Pavol Šimo commented on JIBX-231:
---------------------------------

The issue seems to be related to element nesting. Attributes are missing from 
element ConditionalProperties which is nested in another ConditionalProperties 
element (or Collection in Collection).
But this is not only issue with unmarshalling! Manually setting these 
attributes to object tree and marshalling it does not show mentioned attributes 
too.

Try this code:
                IBindingFactory bfact = 
BindingDirectory.getFactory(DisplayProfile.class);
                IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
                DisplayProfile dp = (DisplayProfile) uctx.unmarshalDocument(new 
FileInputStream("dptest.xml"), null);

                ConditionalProperties pr = new ConditionalProperties();
                pr.setCondition("client");pr.setValue("XML");
                ConditionalProperties pr1 = new ConditionalProperties();
                pr1.setCondition("locale");pr1.setValue("sk");
                StringProperty sp = new StringProperty();
                sp.setName("desktopContainer");sp.setValue("htmlsk");
                pr1.addChoice(sp);
                pr.addChoice(pr1);
                dp.getProperties().addChoice(pr);
                
                dp.marshallTo(new OutputStreamWriter(new 
FileOutputStream("dptestout.xml")));

and check the resulting file.
This is the relevant part:

        <ConditionalProperties condition="client" value="XML">
            <ConditionalProperties>
                <String name="desktopContainer" value="htmlsk"/>
            </ConditionalProperties>
        </ConditionalProperties>

should be

        <ConditionalProperties condition="client" value="XML">
            <ConditionalProperties condition="locale" value="sk">
                <String name="desktopContainer" value="htmlsk"/>
            </ConditionalProperties>
        </ConditionalProperties>


> Missing required attibutes after unmarshalling
> ----------------------------------------------
>
>                 Key: JIBX-231
>                 URL: http://jira.codehaus.org/browse/JIBX-231
>             Project: JiBX
>          Issue Type: Bug
>          Components: core
>    Affects Versions: JiBX 1.1.6
>         Environment: java version "1.5.0_13"
>            Reporter: Pavol Šimo
>         Attachments: dp-model.zip
>
>
> After unmarshalling the enclosed file (dptest.xml) the required attributes 
> are missing from elements Collection (name) and ConditionalProperties 
> (condition, value). See and compare with the marshalled document 
> (dptestout.xml) at lines 7, 96, 126 and 133.
> Attached is the whole project, build.xml is in bin/ and used binding is 
> config/psdp.jibx.xml
> The output file is generated from test case DPTest.testUnmarshall() (from 
> test folder).

-- 
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 the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to