Hi Mark,
On 02.12.2010 14:47, Mark Hoebeke wrote:
Thank you Werner for your feedback. If you decide to tackle this issue,
I'll most probably try out your different proposals.
When I mentioned the term 'input' below, I was actually referring to
'contributions', and not just requests and/or feedback. In the end,
Castor is an open source project, and it's about time that it's user
community does get involved a bit more.
I am more than happy to stay with Castor as a committer and take on the
role of releasing Castor when appropriate, but I am growing a bit tired
to see request after request being raised *without* almost any input
(code reviews, patches, ....) from its users.
Please bear in mind that this is not directed towards you in particular,
but it just occurred that your comment triggered something inside of me
.. ;-).
In the mean time, I've been giving this some thought, and a (quite
inefficient) workaround that doesn't rely on CASTOR modifications could
be to :
1/ Define a mapping file with all the non-dynamic fields
2/ When needed, read in the mapping file as a DOM tree and add the nodes
corresponding to the dynamic field names to list of children of their
class node. Then dump the resulting tree in a temporary file.
3/ Set the mapping location of the Marshaller to this temporary file.
Apart from the performance hit, do you see any flaws in this "hack" ?
I have not tried it myself, but I cannot see any drawbacks apart the
obvious one, i.e. it might be a bit non-performing and feels -
process-wise - a bit odd.
Cheers
Werner
Cheers,
Mark
Le 30/11/2010 10:55, Werner Guttmann a écrit :
Hi Mark,
this is currently not an option with Castor. But given the increasing
frequency of people asking for precisely this feature, I am more than
willing to look into this - given that there's input from the folks
requesting this.
Regards
Werner
On 30.11.2010 09:31, Mark Hoebeke wrote:
Hi,
I have been exploring Castor for some time now, but couldn't find an
answer to the issue I'm facing.
I need to dynamically generate element names from the keys of a HashMap.
For instance, if my map looks like :
{ 'color' => 'red', 'size' => 'xl', 'price' => 10.0 }
I'd like the XML fragment to look like :
<color>red</color>
<size>xl</size>
<price>10.0</price>
This looks like bad practice, but the actual values of the keys in the
map are constrained making it possible to define a schema against which
to validate the generated XML. Moreover, it is impractical to define
classes having fields for every possible key of the map. Hence the need
to try a dynamic element generation approach.
Any clues welcomed !
Mark
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email