Hi Dmitry,

I don't really understand your issue from this. If you want to marshal out the representation shown you don't need a <mapping> for Pools at all. Instead, your custom code will take care of writing the start and end tags for the <Pools> element. Just have your code work with a collection of Pools objects rather than a single Pools object.

Alternatively, you can write a custom marshaller for the collection of Pools that does basically the same thing as outlined above. The difference would be that with a custom marshaller you could more easily embed the Pools collection within whatever other XML structures you're working with.

Hope that helps. If not, can you be more specific on what you want?

 - Dennis

Dmitry wrote:

First,
Thank you Dennis, Nuno for answering my previous question. Marshalling in
chunks works as Dennis described.

Now I'm almost at the point where I can say I've achived what I need.

Now that I can write data in chunks, I need the final help.

Original structure of my XML was to be <Pools> <Pool>
 ......
  </Pool>
  <Pool>
 ......
  </Pool>
  <Pool>
 ......
  </Pool>

</Pools>

Now I'll be creating <Pools> element manually and just dumping Pool.java
objects (properly mapped and working) in chunks..

The problem is that I have a Top level mapping to a class Pools.java in
which I have a <collection> element mapped as the one containing my Pool
objects.

Now, all I want is to pass a Collection of Pools objects to a marshaller.
How can I create a TOP level mapping telling to JiBX that when I give you a
collection object it will contain just Pool objects, so go ahead and marshal
them as <Pool></Pool><Pool></Pool> ... etc...

MUST I have some custom class in which I must define an attribute of type
collection and map it that way, or I can somehow map generic java collection
and inform JiBx what's inside of it.

I have NO problem making a class containing the collection attribute, that's
what I have right now. But the problem is that I seem to MUST give that
mapping a name! And then that name is being outputted into the output file
and screwing me up.. So currently I have class Pools mapped and when I start

Dumping data in chunks to a file I get this:

<Pools>
<Pool>
</Pool>
<Pool>
</Pool>
... </Pools> - chunk one

<Pools>
<Pool>
</Pool>
<Pool>
</Pool>
... </Pools> - chunk two
<Pools>
<Pool>
</Pool>
<Pool>
</Pool>
... </Pools> - chunk three

When what I want is:

<Pools>

<Pool>
</Pool>
<Pool>
</Pool>
...          - chunk 1
<Pool>
</Pool>
<Pool>
</Pool>
 ........   - chunk 2
<Pools>

<Pool>
</Pool>
<Pool>
</Pool>  - chunk 3
... </Pools> - (the element Pools should only be created ONCE!!!

Please help me to achive this..

How do I map it? Or maybe I need to create <Pools> tag manually?
Then again, how do I just map a collection of those Pool objects directly?


Regards,

Dmitry.





-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to