users@jaxb.java.net

Re: Order of marshalling items in a collection in JAXB 2.1

From: Martin Grebac <Martin.Grebac_at_Sun.COM>
Date: Fri, 04 Dec 2009 13:31:50 +0100

Hi,
 would you please file this as a spec issue to JAXB issue tracker? I'll
have a look at it. The order is mandated by the Java type used for
mapping, and as Wolfgang mentioned there is such a clause in the spec.
I'll look if and how that applies to your case and whether the spec is
clear or not.
 Thanks. With regards,
  MartiNG

Nigel Kerr wrote:
> This may be as strong a reed as there is in the current spec, then. I
> would advocate strengthening this aspect, possibly:
>
> All collection types are list or array types expressly, not just bags
> or sets, unless otherwise specified
>
> or even just something on what exactly happens to the collections at
> marshalling time, regardless of what the type is ("All arrays are
> consulted from index zero sequentially, all Collection types are
> iterated by their default iterators").
>
> Thank much.
>
> On Fri, Dec 4, 2009 at 3:32 AM, Wolfgang Laun <wolfgang.laun_at_gmail.com> wrote:
>
>> It seems that you have discovered an omission in the spec. Although,
>> from the Java point of view, not all iterable collections have a specific
>> order, in the sense that the same Java program will, or is bound to,
>> produce the same order on different JVMs.
>>
>> A quote from the spec:
>> "If the ordering between the children elements is significant and must be
>> accessible to the Java application, then the ordering is naturally
>> preserved in Java representation via a collection."
>>
>> I interpret this to hold for both directions, i.e., whenever the Java
>> collection type implies a portable order of its elements then this
>> will be the order of the marshalled XML elements.
>>
>> -W
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>

-- 
Martin Grebac, http://blogs.sun.com/mgrebac
Web Technologies & Standards
Sun Microsystems Czech
ICQ: 93478885