logo       

RE: default values for created beans: msg#00153

text.xml.xmlbeans.user

Subject: RE: default values for created beans

That would be very usefull. I am currently getting around it by jumping
in at the point of instantiation. I then check over the schema of the
newly created bean, adding any default string values, and instantiating
child elements a number of times equal to the value of minOccurs.

It would be a very clean mechanism to be able to define a complete
default structure from within the schema and have that then represented
when you instantiate an XmlBean.

Cheers
Marius.

On Tue, 25 Jan 2005 07:06:32 +0100, florian.hehlen@xxxxxxx said:
> Hi.
>
> I find that very interesting. Although I am not sure I would wan it to be
> a default behaviour. Maybe any given bean could provide a method like
> addDefaultElements() to populate the document with minimum elements and
> default values.
>
> I think it is a valuable feature of XMLBeans that _invalid_ documents can
> be built/manipulated with it.
>
> Florian Hehlen
>
> >-----Original Message-----
> >From: mg [mailto:xmlbeans@xxxxxxxxxxxxxxxxxxxxx]
> >Sent: Tuesday, January 25, 2005 3:16 AM
> >To: user@xxxxxxxxxxxxxxxxxxx
> >Subject: default values for created beans
> >
> >
> >Hi there,
> >
> >I am creating new beans using the addNewXXX methods in the compiled
> >beans. However I was really hoping that the default values that I have
> >specified in the schema would be used to fill in the new bean.
> >Also if a
> >child element is specified as having a minOccurs of 1 I would
> >think that
> >the element would be automatically created as well.
> >
> >What do you think?
> >Marius.
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@xxxxxxxxxxxxxxxxxxx
> >For additional commands, e-mail: user-help@xxxxxxxxxxxxxxxxxxx
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xxxxxxxxxxxxxxxxxxx
> For additional commands, e-mail: user-help@xxxxxxxxxxxxxxxxxxx
>


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise