Stephen,

Thanks for the response.  SourceGenerator is creating the attributes as
the object type i.e. Long rather than long.

In my castor_builder.properties file I'm setting the
org.exolab.castor.builder.primitivetowrapper=true.  If this wasn't set
the attributes would be generated as primitives.

Given that the attributes are the object type and the xsd specifies the
nillable attribute I would assume castor would leave things as null
unless it is passed a specific value.

Is this something I need to create a JIRA for?  Or am I just missing
some fundamental setting?

Thanks,

Greg


  
-----Original Message-----
From: Stephen Bash [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 10, 2006 1:24 PM
To: [email protected]
Subject: Re: [castor-user] XML - Nillable numeric elements defaulting to
0 when passed empty element - Created with Source Gen

Greg-

I'm no expert on the nillable support in the SourceGenerator, but I'll
see if I can ask an intelligent question...  If you look at the
generated classes, does the class contain a long or a Long?  It
appears there is a SourceGenerator option ("asWrapper" in the code,
not sure how it is specified to the SourceGenerator) to make Castor
use primitive wrapper objects rather than the primitives themselves. 
If a primitive wrapper is used I could see Castor setting the value to
null, but with a true primitive, I think 0 is the best it can do...

Don't know if that is any help at all, but I hope it accomplishes
something :)

Stephen


On 4/9/06, Greg Garson <[EMAIL PROTECTED]> wrote:
> I can see some discussion on this in the mailing archive but it
doesn't
> seem to answer my question.  Using a SourceGen'd class containing an
> element defined as:
>
> xsd:element name="assignedToUser" type="xsd:long"
> nillable="true"></xsd:element>
>
> I pass the element instance:
>
> <assignedToUser xsi:nil="true" xmlns=""/>
>
> Castor sets the value in the resulting class to 0 instead of leaving
it
> blank.  Is it assumed by Castor that an empty numeric element = 0?  Is
> there some setting I'm missing?
>
> Thanks,
>
> Greg
>
> -------------------------------------------------
> 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