users@jaxb.java.net

influencing the ordering of attributes for marshalling

From: Peter Meulmeester <pmeulmeester_at_CATLOGIC.COM>
Date: Fri, 27 Jun 2003 03:54:27 -0600

Hi,

My XML files will be editted by machine and humans. I noticed that after marshalling the ordering of the attributes are changed. This is not very nice for people who would like to get used to a certain order of attributes and default values.

I use:
m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );

I noticed that the order of the attributes is changed only after I have added a "record" programmatically in my java code using:

  ObjectFactory objFactory = new ObjectFactory();
  Keys.KeyType key = objFactory.createKeysKeyType();
  key.setId("newKey");

Is there a way to specufy that the order in the schema should be maintained?

best regards,
Peter