cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <>
Subject Re: arrays of nil versus nil array
Date Mon, 22 Oct 2007 14:34:39 GMT


This depends on if you are using Aegis or JAXB (and is one area where 
Aegis has the advantage).     JAXB maps this to:

<element type="string" maxOccurs="unbounded" minOccurs="1" 
nillable="true" name="bleep"/>

In that case, the nillable does NOT apply to the entire array.   Just the 
elements in the array.   (the nillable applies for each "bleep" element 
written out.) With the jaxb mapping, there is no way to distinguish 

bleep = null;
bleep = new String[0];

Both cases would result in no "bleep" elements being written on the wire.  
I think CXF maps both to "null" on the receiving side of the wire.

bleep = new String[] {null};
would result in a single bleep element with nil="true" set.

Aegis, on the other hand, maps it to:
<element type="ArrayOfString" nillable="true" name="bleep"/>
which does allow the distinction as the array itself is represented by 
the bleep element, and the array items are represented by the element 
inside of the ArrayOfString type.


On Monday 22 October 2007, Benson Margulies wrote:
> XML schema-wise, say that we started, code-first, with
>    String bleep[];
> So, bleep could be null, and then each of the strings inside bleep
> could be nil.
> If the nillable attribute for the schema element for bleep refers to
> the entire array, where's the one for the array elements? Does there
> need to be a complex type in this case?
> I guess I better haul out my XML Schema book.
> --benson

J. Daniel Kulp
Principal Engineer
P: 781-902-8727    C: 508-380-7194

View raw message