users@jaxb.java.net

Re: Sorting the arguements

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Fri, 19 Nov 2010 19:44:50 +0100

Hi,

On Fri, Nov 19, 2010 at 6:29 PM, Hello! hello <prosp4300_at_gmail.com> wrote:
> Order of attributes is controlled by schema file, if you use java-to-schema
> mapping, this can be customized easily by
> @XmlType(propOrder={"action", "companyId", "companyName", "descData"})
> public class AchCompany {}

This is not correct.

http://download.oracle.com/javaee/5/api/javax/xml/bind/annotation/XmlType.html:

"The annotation element propOrder() can be used to customize the
content model to be xs:all or xs:sequence. It is used for specifying
the order of XML elements in xs:sequence."

This does not apply to attributes.

In any case the order of attributes in XML is not significant:

http://www.w3.org/TR/REC-xml/#sec-starttags

"Note that the order of attribute specifications in a start-tag or
empty-element tag is not significant."

Bye,
/lexi