cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Freeman Fang <freeman.f...@gmail.com>
Subject Re: Excluding empty array elements from the generated message
Date Mon, 15 Nov 2010 10:05:21 GMT
Hi Jaco,

I believe if you use nillable=true and setItems(null), there should be  
no <ns2:Items />.
But if you setItems(new String[]) string[] isn't null but the length  
is 0, I think have <ns2:Items /> is expected behavior, as it's  
different with null.

Freeman

On 2010-11-15, at 下午5:00, Jaco Prinsloo wrote:

> Hi Freeman,
>
> Sorry, I should have added. I tried setting nillable to false and I  
> also
> tried leaving it out completely, but none of it helped.
>
> Thank you,
> Jaco
>
> On Mon, Nov 15, 2010 at 10:11 AM, Freeman Fang  
> <freeman.fang@gmail.com>wrote:
>
>>
>> On 2010-11-15, at 下午4:05, Jaco Prinsloo wrote:
>>
>> Hi,
>>>
>>> I have an element which is annotated as given below:
>>>
>>> @XmlElement(name = "Items", nillable = false, required = false)
>>> public String[] getItems() {
>>>  return items;
>>> }
>>>
>> Hi,
>>
>> How about change nillable=true to see if it helps?
>>
>> Freeman
>>
>>
>>> It generates fine when it contains items, and generates an empty  
>>> element
>>> when it does not:
>>>
>>> <ns2:Items />
>>>
>>> Is there any way that I can configure Apache CXF to exclude this  
>>> element
>>> when it is empty, in other words, not to generate anything for it?
>>>
>>> Thank you,
>>> Jaco
>>>
>>
>>
>> --
>> Freeman Fang
>>
>> ------------------------
>>
>> FuseSource: http://fusesource.com
>> blog: http://freemanfang.blogspot.com
>> twitter: http://twitter.com/freemanfang
>> Apache Servicemix:http://servicemix.apache.org
>> Apache Cxf: http://cxf.apache.org
>> Apache Karaf: http://karaf.apache.org
>> Apache Felix: http://felix.apache.org
>>
>>


-- 
Freeman Fang

------------------------

FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message