users@jaxb.java.net

RE: sequence of attributes

From: Lagomasino, Adolfo (Adolfo) <"Lagomasino,>
Date: Tue, 11 Jan 2005 11:18:11 -0500

I think having the order in the schema definition specify the order of the attributes would be a great feature to have.

We use JAXB on a data modeling tool that maintains an XML document ("the datamodel"). The users of the tool keep the XML datamodel under change control.

I have observed situations whereby modifying the schema by simply adding a new attribute to an element, the order of the attributes changed inexplicably. And by the way, not in alphabetical order. This is disruptive to the user because by just unmarshaling and marshaling the document with the new version everything appears to have changed.

Writing an XMLWriter to preserve the order of attributes is doable, but breaks the beauty of JAXB by having to update the Writer manually each time there is a change in the schema.

Adolfo

 

-----Original Message-----
From: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
Sent: Tuesday, January 11, 2005 11:01 AM
To: users_at_jaxb.dev.java.net
Subject: Re: sequence of attributes


Kees wrote:
> The sequence of attributes seems to be alphabetical.
> The sequence of elements are the same sequence as in the schema.
>
> Is there a way to get the sequence of attributes the same as in the schema?

I'm afraid not. I don't remember sorting them inside the JAXB RI, but
there really isn't a way to control their ordering.

Perhaps you could write your own XMLWriter that knows how to rearrange
attributes?


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net