Hi Andy,

Andy wrote:
> I am generating manually.  I just ran a test and if I set either 
> nillable="true" or minOccurs="0",
Problem is that by calling setNarrative() you are setting a value,
indeed. 'null' is actually a valid value for non-scalar fileld types.

Just to make sure: what Castor version are you using ?

Btw, 'minOccurs' and 'nillable' will behave in different ways. Adding
nillable="true" to an element definition has its own characteristics,
and Castor will support those.

> AND do not call setNarrative(null),
> then it omits the element.
Correct.

>  Apparently setting null causes the 
><NARRATIVE /> but not calling the method at all leave it ommitted.
> 
>  
> 
> Thanks,
> Andy
> 
>  
> 
> 
>  
>> Date: Tue, 21 Jul 2009 20:08:06 +0200
>> From: [email protected]
>> To: [email protected]
>> Subject: Re: [castor-user] [XML] How to omit <Narrative />?
>>
>> Andy,
>>
>> are you generating Java classes from an XML schema, or are you mapping
>> manually ?
>>
>> Werner
>>
>> Andy wrote:
>>> Hi, I have tried using nillable="true" as well as minOccurs="0", but 
>>> neither seem to work.
>>>
>>>
>>>
>>>
>>>
>>> <xs:element name="PERSON">
>>> <xs:complexType>
>>> <xs:sequence>
>>> <xs:element name="FIRSTNAME" type="xs:string"/>
>>> <xs:element name="LASTNAME" type="xs:string"/>
>>> <xs:element name="DOB" type="xs:string" nillable="true"/>
>>> <xs:element name="NARRATIVE" type="xs:string" minOccurs="0"/>
>>> </xs:sequence>
>>> </xs:complexType>
>>> </xs:element>
>>>
>>>
>>>
>>>
>>>
>>> -Andy
>>>
>>>
>>>
>>>
>>>
>>>> Date: Tue, 21 Jul 2009 09:50:04 +0200
>>>> From: [email protected]
>>>> To: [email protected]
>>>> Subject: Re: [castor-user] [XML] How to omit <Narrative />?
>>>>
>>>> Hi,
>>>>
>>>> it all depends. Is this element required or optional ? In other words,
>>>> if you had an XML schema, what would the element definition look like
>>>> for this 'Narrative' element ?
>>>>
>>>> Regards
>>>> Werner
>>>>
>>>> Andy wrote:
>>>>> Hi, I have an element being generated by Castor named <Narrative>.
>>>>> If I call setNarrative(null), I get --> <Narrative />. Is there a
>>>>> flag I can set in Castor to either have the entire element omitted
>>>>> from the XML or have it show <Narrative></Narrative>?
>>>>>
>>>>> Thanks!
>>>>>
>>>>> _________________________________________________________________ 
>>>>> Windows Live™ Hotmail®: Celebrate the moment with your favorite
>>>>> sports pics. Check it out. 
>>>>> http://www.windowslive.com/Online/Hotmail/Campaign/QuickAdd?ocid=TXT_TAGLM_WL_QA_HM_sports_photos_072009&cat=sports
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe from this list, please visit:
>>>>
>>>> http://xircles.codehaus.org/manage_email
>>>>
>>>>
>>> _________________________________________________________________
>>> Windows Live™ Hotmail®: Celebrate the moment with your favorite sports 
>>> pics. Check it out.
>>> http://www.windowslive.com/Online/Hotmail/Campaign/QuickAdd?ocid=TXT_TAGLM_WL_QA_HM_sports_photos_072009&cat=sports
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>> http://xircles.codehaus.org/manage_email
>>
>>
> 
> _________________________________________________________________
> Windows Live™ Hotmail®: Celebrate the moment with your favorite sports pics. 
> Check it out.
> http://www.windowslive.com/Online/Hotmail/Campaign/QuickAdd?ocid=TXT_TAGLM_WL_QA_HM_sports_photos_072009&cat=sports

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to