|
From: =?iso-8859-1?Q?<jp....@ti...> - 2003-05-28 11:45:48
|
Hi Rod,=0D=0A=0D=0AAs long as we have the same logic in "element" and "pr= operty", we can disable either the value attribute either the body conten= t depending on the way you prefer. I am agnostic on this.=0D=0AThe way to= define a value will be unique, but we will have in any case the possibil= ity of defining directly on the property or in an "element". =0D=0AWe can= also define that when "element" are included in the property, it's neces= sarly an array of collection with one item only?=0D=0AIn this case, all d= efinitions are one way possible.=0D=0A=0D=0AJean-Pierre=0D=0A=0D=0A------= ---- Initial Header -----------=0D=0A=0D=0AFrom : <rod.johnson@inter= face21.com>=0D=0ATo : "jp....@ti..." <jp.pawlak@tiscali.= fr>=0D=0ACc : "rod.johnson" <rod...@in...>, = isabelle <isa...@me...>, "rod.johnson" <rod.johnson@int= erface21.com>, springframework-developer <springframework-developer= @lists.sourceforge.net>=0D=0ADate : Wed, 28 May 2003 07:25:25 -0400=0D= =0ASubject : Re: Re: [Springframework-developer] Spring bean factory XML= format=0D=0A=0D=0AJP suggested:=0D=0A=0D=0A<bean class=3D"MyClass" id=3D= "foos" singleton=3D"false> =0D=0A<property name=3D"foo">FOO</property> =0D= =0A<property name=3D"foo2" value=3D"FOO2"/> =0D=0A<property name=3D"foo3"= refid=3D"foo3"/> =0D=0A<property name=3D"foo4"> =0D=0A <data>FOO4.1</d= ata> =0D=0A <data value=3D"FOO4.2"/> =0D=0A <data refid=3D"foo4.3"/> = =0D=0A</property> =0D=0A</bean> =0D=0A=0D=0A=0D=0AThe problem I see here = is that there are 3 ways of defining =0D=0Aliterals:=0D=0A- in the body o= f the property element (as before)=0D=0A- in a value attribute. I don't t= hink this is a good idea, as =0D=0Aattributes can only hold simple string= s without getting into =0D=0Anasty escaping.=0D=0A- in a <data> element, = which is necessary anyway for a =0D=0Acollection.=0D=0A=0D=0AJuergen make= s a good point about mixed collections of =0D=0Areferences and string dat= a (which of course would be =0D=0Aconverted to objects). Initially I thou= ght this was unlikely, =0D=0Abut I realised it has quite a few uses (with= the AOP proxy =0D=0Afactory, for example), and the <value> subelement I = suggested =0D=0Ahandles it. (It's already implemented: see collections.xm= l in =0D=0Abeanfactory.xml tests.)=0D=0A=0D=0AThe most consistent approac= h IMHO is:=0D=0A=0D=0A<bean class=3D"MyClass" id=3D"foos" singleton=3D"fa= lse> =0D=0A<property name=3D"foo"><value>FOO</value></property> =0D=0A=0D= =0A<property name=3D"foo3">=0D=0A <ref refid=3D"foo3"/> =0D=0A</property= >=0D=0A<property name=3D"foo4"> =0D=0A <value>FOO4.1</value> =0D=0A <= value>FOO4.2</value>=0D=0A <ref refid=3D"foo4.3"/> =0D=0A</property> =0D= =0A</bean> =0D=0A=0D=0AAlways consistent: always at least one value or re= f =0D=0Asubelement of a property elt; <value> contains only text =0D=0Ada= ta; ref body must be empty.=0D=0A=0D=0ASlightly more verbose, but probabl= y easier to author with an =0D=0AXML editor (even the basic Eclipse XML e= ditor I use most of =0D=0Athe time).=0D=0A=0D=0AI don't care whether it's= called value or data, or anything =0D=0Aelse...any ideas?=0D=0A=0D=0AReg= ards,=0D=0ARod=0D=0A=0A=0A********** SPECIAL ADSL **********=0AL'ADSL =E0= partir de 15,95 EUR/mois et le modem ADSL offert ? C'est en exclusivit=E9= chez Tiscali !=0APour profiter de cette offre, cliquez ici: http://regis= ter.tiscali.fr/adsl/=0AOffre soumise =E0 conditions.=0A |