<binding>
<mapping name="testsuite" class="TestSuite">
<structure allow-repeats="true" ordered="false">
<structure name="tests">
<collection field="tests" 
factory="org.jibx.runtime.Utility.arrayListFactory"/>
</structure>
</structure>
</mapping>

<mapping name="test" class="Test" value-style="attribute">
<value name="name" field="name"/>
</mapping>
</binding>

This binding xml can be used to unmarshall your example xml. I cannot 
find a way by which you can propagate the status to the child test 
elements without changes to the model and code in jibx's method hooks.

Interesting problem. Ideas' anyone?

cheers
Varghese C V

Bret Gregory wrote:
>
> I am evaluating JiBX and am interested in seeing if it can handle a 
> scenario that I have had some difficulty with using other XML binding 
> tools.
>
> The benchmarks are impressive and alone are a convincing argument to 
> use it, but I have been burned by XML-Binding frameworks in the past.
>
> Can anyone show a simple binding that would handle a case like this?
>
> Problem:
>
> Given the following XML, I would like to unmarshall this into 2 
> classes. Can a binding like this be made without writing additional 
> code to support it?
>
> TestSuite maps 1:1 to the <testsuite> element. The class contains a 
> list of tests which map to the <test> element, however the Test class 
> also contains a status which is from the <tests> element, the parent 
> element of <test>.
>
> TestSuite
>
> List tests
>
> Test
>
> String name
>
> String status
>
>
> <testsuite>
>
> <tests status=”FAILED”>
>
> <test name=”test1”/>
>
> <test test name=”test2”/>
>
> <test test name=”test3”/>
>
> <test name=”test4”/>
>
> </ tests>
>
> <tests status=”PASSED”>
>
> <test test name=”test5”/>
>
> <test test name=”test6”/>
>
> <test test name=”test7”/>
>
> <test test name=”test8”/>
>
> </tests>
>
> </testsuite>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> ------------------------------------------------------------------------
>
> _______________________________________________
> jibx-users mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>   


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to