|
[
Permalink
| « Hide
]
Aleksandar Seovic added a comment - 27/Mar/05 10:44 PM
I don't think this is the best way to do it. What happens if you want some entries to have multiple values and some single? I'd rather move multi-value attribute to entry element, or better yet, simply use "values" instead of "value" to specify that entry has multiple values.
Moved to 1.1 while we figure out how to support this.
This forum posting describes a possible configuration style.
http://forum.springframework.net/viewtopic.php?t=71 Hi,
Following up on Aleks suggestion.. <property name="nvProp"> <name-values> <add key="myMultiValueKey" values="foo,qwerty,asdf"/> <add key="mysingleValueKey" value="tomf"/> <add key="myMultiValueKeyWithDelim" values="wallace,grommit:charliebrown,snoopy" delimiter=":"/> </name-values> </property> string[] ss = obj1.nvProp.GetValues("myMultiValueKey"); ss[0] = [foo] ss[1] = [qwerty] ss[2] = [asdf] string[] ss = obj1.nvProp.GetValues("myMultiValueKeyWithDelim"); ss[0] = [wallace,grommit] ss[1] = [charliebrown,snoopy] I actually ended up with a slightly different schema: there is no 'values' attribute, but if 'delimiters' attribute is specified value will be treated as a multi-valued, delimiter-separated string.
<property name="props"> <name-values> <add key="name" value="Twain, Mark"/> <add key="foo" value="bar1,bar2,bar3" delimiters=","/> <add key="days" value="monday,tuesday.wednesday:thursday'friday!saturday|sunday" delimiters=",.:'!|"/> </name-values> </property> First value in the example above will be treated as a single-valued string, "Twain, Mark", while the other two will be split up using specified delimiters and treated as multi-valued strings. |
||||||||||||||||||||||||||||||||||||||