hello,

change this:
<mapping name="table" class="Table">
        <collection field="rows" item-type="Row"/>
</mapping>

to this:
<mapping name="table" class="Table">
        <collection name="rows" field="rows" item-type="Row"/>
</mapping>

i haven't actually tried it in your case but it should work.

thanks, eitan


On Mar 1, 2005, at 3:47 PM, Mocky Habeeb wrote:

First I'd like to say that I love this framework. I first learned of it
a few weeks ago when I watched the Javapolis video of the presentation
on XML binding. I immediately knew that this was just what I needed, and
I implemented it in the project I'm working on in a very short time.
It's very flexible and performance is great.


I read the archives looking for a solution to this problem but I haven't
seen one.
Here is my problem, I have XML that looks like this:


<table>
        <row number="1" value="firstval"/>
        <row number="2" value="second"/>
        <row number="3" value="more"/>
</table>

And I created classes that look like this:

class Table {
        private ArrayList rows;
}

class Row {
        private String number;
        private String value;
}

Then I created a binding that looked something like this:

<mapping name="table" class="Table">
        <collection field="rows" item-type="Row"/>
</mapping>
<mapping name="row" class="Row">
        <value name="number" field="number"/>
        <value name="value" field="value" />
</mapping>

All was good until the XML was changed on me putting a new parent
element named 'rows' around the 'row's

<table>
        <rows>
                <row number="1" value="firstval"/>
                <row number="2" value="second"/>
                <row number="3" value="more"/>
        </rows>
        <metadata desc="a bunch other stuff that doesn't matter to this
problem"/>
</table>

Well I like my class structure and don't want to change it, so I changed
the binding in a number of different ways including this:


<mapping name="table" class="Table">
        <collection field="rows" item-type="Row"/>
</mapping>
<mapping name="rows" class="Row">
        <structure name="rows">
                <value name="number" field="number"/>
                <value name="value" field="value" />
        </structure>
</mapping>

And I could tell you what error messages I'm getting, but basically I
don't know how to express what I want in the binding.xml, so I know that
it's not going to work.


Suggestions?


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to