Dear all,
I've been using Castor-XML for several month now and I'm happy with it.
However,...
It seems that the order of an array or vector is not preserved in case that
array is told to be stored using reference="true" in the bind-xml element.
For example, my situation is like this : I have a tree. Each node of the tree
contains a vector of children (standard stuff). However, I have a "big" array
in which I put a reference to all the nodes of the tree. Therefore, I have
two ways to run the tree : by doing a standard, recursive tree run on each
nodes or by looking at the nodes as they are listed in the "big" array. Now,
when I store the elements in XML with Castor, I instruct it to store the
"big" array, not the elements as a tree-structure (this makes a cleaner XML).
Therefore, it stores all the nodes, one by one, ordered as in the big array.
Each node's child is represented as a reference (using <bind-xml
reference="true"...) Unfortunately, when I do that, Castor looses the order
of the elements in each of the vector of children. However, the resulting
order is not random, it strictly follows the order in which the nodes appears
in the "big" array. So, whatever the order of the children of any node,
everything gets reordered according to the big array's order.
As a fix, I have told Castor to store the node of the tree recursively,
without reference, and after that, to store the "big" array with references
to the nodes. Working this way brings the result I expected (however
information is duplicated).
I checked the bug reports and it seems there are some issues with ordering,
but I don't feel I'm connected to those issues. Moreover, I noticed that
nowhere in the documentation it is said that the order is preserved, so maybe
it's just a feature :)
Thank you for any help.
stF
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user