Michael-

Just to make sure we're all on the same page, when you say "the field
is empty", is the xml attribute not there, or is it set to the empty
string ""?  Similar question applies to elements, is it not there, or
is it empty (<foo/>)?

Thanks,
Stephen


On 3/22/06, Werner Guttmann <[EMAIL PROTECTED]> wrote:
> Ralf,
>
> I read Stephen's comment in the way that the source generator apparently (to 
> be verified) can deal with nillable being used in an XML Schema. That imho 
> would imply that the XMLClassDescriptots being generated know how to deal 
> with such situations. If that's the case, my idea was to 'implement' a 
> similar (if not the same .. ;-)) funtionality for people not using the source 
> generator, but relying on mapping files only.
>
> Werner
>
> > -----Original Message-----
> > From: Ralf Joachim [mailto:[EMAIL PROTECTED]
> > Sent: Mittwoch, 22. März 2006 10:03
> > To: [email protected]
> > Subject: Re: [castor-user] Castor defaults numeric java objects to 0
> >
> > I don't think something should be added to the mapping file.
> > The user should be able to set default value in his source
> > code and Castor should only change this value when a
> > corresponding tag or attribute is unmarshalled. If Castor
> > changes a property when it should not then this is a bug.
> >
> > When there is no possibility to define a default value for a
> > property with source generator then we should add this
> > feature to source generator.
> >
> > Ralf
> >
> >
> > Werner Guttmann schrieb:
> > > Stephen, Michael,
> > >
> > > Why don't we add a 'nillable' attribute to the mapping file ?
> > >
> > > Werner
> > >
> > >
> > >>-----Original Message-----
> > >>From: Stephen Bash [mailto:[EMAIL PROTECTED]
> > >>Sent: Dienstag, 21. März 2006 21:12
> > >>To: [email protected]
> > >>Subject: Re: [castor-user] Castor defaults numeric java objects to 0
> > >>
> > >>Michael-
> > >>
> > >>So I remembered this discussion a while back and dug through the
> > >>archives to find it.
> > >>
> > >>http://marc.theaimsgroup.com/?l=castor-user&m=112267315616893&w=2
> > >>
> > >>If you're using a schema and source generation, then possibly using
> > >>nillable in the schema will help.
> > >>
> > >>Just went digging through the code, and while there doesn't
> > seem to be
> > >>a way to access nillable from the mapping file, you can set
> > nillable
> > >>if you get your hands on the XMLFieldDescriptorImpl.  I
> > could see an
> > >>implementation (albeit non-optimal) where a mapping file is loaded,
> > >>and then the the necessary ClassDescriptors are retrieved
> > in order to
> > >>get the XMLFieldDescriptor objects and set nillable to true.
> > >>
> > >>Sorry I can't be of much more help.
> > >>
> > >>Stephen
> > >>
> > >>
> > >>On 3/21/06, Michael Heath <[EMAIL PROTECTED]> wrote:
> > >>
> > >>>True objects, Floats, Integers, etc.
> > >>>
> > >>>
> > >>>
> > >>>>From: "Stephen Bash" <[EMAIL PROTECTED]>
> > >>>>Reply-To: [email protected]
> > >>>>To: [email protected]
> > >>>>Subject: Re: [castor-user] Castor defaults numeric java
> > >>
> > >>objects to 0
> > >>
> > >>>>Date: Tue, 21 Mar 2006 14:18:36 -0500
> > >>>>
> > >>>>Michael-
> > >>>>
> > >>>>What types of objects are we referring to?  Primitives, primitive
> > >>>>wrappers or true objects?
> > >>>>
> > >>>>Thanks,
> > >>>>Stephen
> > >>>>
> > >>>>
> > >>>>On 3/21/06, Michael Heath <[EMAIL PROTECTED]> wrote:
> > >>>>
> > >>>>>Hi,
> > >>>>>
> > >>>>>I have XML I am unmarhsalling and when the field is
> > >>
> > >>empty I want
> > >>
> > >>>>>to have
> > >>>>
> > >>>>the
> > >>>>
> > >>>>>java object set to null.
> > >>>>>
> > >>>>>The default behaviour appears to be setting the java
> > >>
> > >>object to a 0
> > >>
> > >>>>>value...this is of course a big problem if the value is
> > >>
> > >>supposed
> > >>
> > >>>>>to be
> > >>>>
> > >>>>empty
> > >>>>
> > >>>>>and not 0.
> > >>>>>
> > >>>>>Can anyone advise? I wrote a custom field handler but
> > >>
> > >>this seems
> > >>
> > >>>>>to be called after the object is created and set to 0.
> > >>>>>
> > >>>>>thanks
> > >>>>>M
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>-------------------------------------------------
> > >>>>>If you wish to unsubscribe from this list, please send an empty
> > >>>>>message to the following address:
> > >>>>>
> > >>>>>[EMAIL PROTECTED]
> > >>>>>-------------------------------------------------
> > >>>>>
> > >>>>>
> > >>>
> > >>>
> > >>>
> > >>>-------------------------------------------------
> > >>>If you wish to unsubscribe from this list, please send an empty
> > >>>message to the following address:
> > >>>
> > >>>[EMAIL PROTECTED]
> > >>>-------------------------------------------------
> > >>>
> > >>>
> > >>
> > >
> > > -------------------------------------------------
> > > If you wish to unsubscribe from this list, please send an empty
> > > message to the following address:
> > >
> > > [EMAIL PROTECTED]
> > > -------------------------------------------------
> >
> > --
> >
> > Syscon Ingenieurbüro für
> > Meß- und Datentechnik GmbH
> > Ralf Joachim
> > Raiffeisenstraße 11
> > D-72127 Kusterdingen
> > Germany
> >
> > Tel.   +49 7071 3690 52
> > Mobil: +49 173 9630135
> > Fax    +49 7071 3690 98
> >
> > Email: [EMAIL PROTECTED]
> > Web:   www.syscon-world.de
> >
> > -------------------------------------------------
> > If you wish to unsubscribe from this list, please send an
> > empty message to the following address:
> >
> > [EMAIL PROTECTED]
> > -------------------------------------------------
> >
> >
> >
>
> -------------------------------------------------
> If you wish to unsubscribe from this list, please
> send an empty message to the following address:
>
> [EMAIL PROTECTED]
> -------------------------------------------------
>
>

Reply via email to