Hi Daniel,

Daniel Garrido wrote:
> Hi Werner,
> 
> I've only been able to map each pair key/value of an hashmap to a new
> element, just like you mentioned.
Do you have a complete test case that demonstrates how you would liek to
use Castor in this very context ? Incl. XMl files that show expected
output, etc. ?

> It would be a great improvement to have a more flexible way of dealing
> with hashmaps.
> I would not mind helping you adding such a functionality , since I
> would enjoy using Castor in my project.
Nor would we .... ;-).

> Just tell me how I can be useful. Developing, debugging, suggesting ideas...
All of them, ideally. If I were you, I'd code up a little test case that
I'd use to debug the current code base, trying to spot the areas here
code could/should be added. From there, a little code addition/change
here, one more there .. et voila. Let me just add that I have not got an
idea how easy or difficult this is going to be.


> Regards,
> Daniel Garrido
> 
> On Fri, Apr 25, 2008 at 9:50 PM, Werner Guttmann
> <[EMAIL PROTECTED]> wrote:
>> Daneil,
>>
>>  this is the right place to suggest such a feature (CCing the dev list as
>>  well). Having said that, let me just add a few random observations:
>>
>>  a) Castor currently does support (Hash)Maps as collection type for
>>  multivalued collections, as per mapping file and through code generation.
>>
>>  b) The syntax is a bit more complicated as for other collection types,
>>  as we do need some flexibility to define the XML binding for the
>>  key/value pair.
>>
>>  c) As far as I know, this is being used for element type content only.
>>
>>  As such, I have to confess that I have never tried to use this against
>>  attribute type. Looks like I have to try this first.
>>
>>  Having said that, if this is not supported, support for such a feature
>>  could be added. Would you be willing to work with us to add such a
>>  feature ?
>>
>>  Regards
>>  Werner
>>  Castor, committer
>>
>>  Daniel Garrido wrote:
>>  > Thank you for your answer!
>>  > Where shall I post a suggestion?
>>  > I think it would be interesting that we could map XML like:
>>  >
>>  > <node attr1="val1" attr2="val2" attr3="val3" attr4="val4" ... />
>>  >
>>  > To an Hashmap where the keys would be the name of the attribute and
>>  > the attribute's values the values associated to the keys of the
>>  > hashmap.
>>  >
>>  > Don't know if this is the right place for suggestions, if not I would
>>  > appreciate if someone tell me where to forward this idea.
>>  > I feel sorry I can't use Castor :(, everything was working so nice
>>  > till this limitation.
>>  >
>>  > Best regards,
>>  > Daniel Garrido
>>  >
>>  > On Fri, Apr 25, 2008 at 9:05 AM, Werner Guttmann
>>  > <[EMAIL PROTECTED]> wrote:
>>  >> Daniel,
>>  >>
>>  >>
>>  >>
>>  >>  Daniel Garrido wrote:
>>  >>  > Hello Castor community!
>>  >>  >
>>  >>  >  Is it possible to do the following:
>>  >>  >
>>  >>  >  Imagine I have the following XML, that I wish to unmarshall:
>>  >>  >
>>  >>  >  <component id="scanner" name="Scanner">
>>  >>  >         <model id="1" name="Foo" forecastMaintHours="80"
>>  >>  >  hourPrice="90" partsPrice="2800" />
>>  >>  >         <model id="2" name="Bar" forecastMaintHours="150"
>>  >>  >  hourPrice="90" partsPrice="14000"/>
>>  >>  >  </component>
>>  >>  >
>>  >>  >  I have a component class:
>>  >>  >
>>  >>  >  public class Component {
>>  >>  >
>>  >>  >         private String id;
>>  >>  >         private String name;
>>  >>  >         private List<Model> models;
>>  >>  >
>>  >>  >  ...
>>  >>  >  }
>>  >>  >
>>  >>  >  A model class:
>>  >>  >
>>  >>  >  public class Model {
>>  >>  >
>>  >>  >         private String id;
>>  >>  >         private List<ModelAttribute> attributes;
>>  >>  >
>>  >>  >  ...}
>>  >>  >
>>  >>  >  and finally a ModelAttribute class (basically it's purpose it to be 
>> an hashmap:
>>  >>  >
>>  >>  >  public class ModelAttribute {
>>  >>  >
>>  >>  >         public String name;
>>  >>  >         public String value;
>>  >>  >  ...}
>>  >>  >
>>  >>  >  Now my question is, how can I map a custom name of a model attribute
>>  >>  >  to the ModelAttribute.name and its value to ModelAttribute.value?
>>  >>  This - to my knowledge - is not supported with Castor.
>>  >>
>>  >>  >
>>  >>  >  Best regards,
>>  >>  >  Daniel Garrido
>>  >>  >
>>  >>  > ---------------------------------------------------------------------
>>  >>  > 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
>>
>>
>>
> 
> ---------------------------------------------------------------------
> 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


Reply via email to