title: How to annotation order field when using XStream on Android?
body: <p>I need to generate XML from java objects on Android. XML nodes must be in 
  definite sequence. Here is what I got(These fields as according to alphabetical order):</p>
  
  <pre><code>&lt;soap:Envelope xmlns:cwmp="urn:dslforum-org:cwmp-1-0" 
  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope" 
  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding" 
  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    &lt;soap:Body&gt;
      &lt;cwmp:Inform&gt;
        &lt;CurrentTime&gt;2013-06-07 07:11:20.561 UTC&lt;/CurrentTime&gt;
        &lt;DeviceId&gt;
          &lt;OUI&gt;002615&lt;/OUI&gt;
          &lt;Manufacturer&gt;Conexant&lt;/Manufacturer&gt;
          &lt;ProductClass&gt;ADSL2+ IAD&lt;/ProductClass&gt;
          &lt;SerialNumber&gt;00261559a496&lt;/SerialNumber&gt;
        &lt;/DeviceId&gt;
        &lt;Event soapenc:arrayType="cwmp:EventStruct[1]"&gt;
          &lt;EventStruct&gt;
            &lt;CommandKey&gt;&lt;/CommandKey&gt;
            &lt;EventCode&gt;0 BOOTSTRAP&lt;/EventCode&gt;
          &lt;/EventStruct&gt;
        &lt;/Event&gt;
        &lt;ParameterList soapenc:arrayType="cwmp:ParameterValueStruct[1]"&gt;
          &lt;ParameterValueStruct&gt;
            &lt;name&gt;InternetGatewayDevice.DeviceInfo.SpecVersion&lt;/name&gt;
            &lt;value&gt;1.0&lt;/value&gt;
          &lt;/ParameterValueStruct&gt;
        &lt;/ParameterList&gt;
        &lt;MaxEnvelopes&gt;1&lt;/MaxEnvelopes&gt;
        &lt;RetryCount&gt;0&lt;/RetryCount&gt;
      &lt;/cwmp:Inform&gt;
    &lt;/soap:Body&gt;
    &lt;soap:Header&gt;
      &lt;ID soap:mustUnderstand="1"&gt;
        &lt;string&gt;00001&lt;/string&gt;
      &lt;/ID&gt;
    &lt;/soap:Header&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>Here is what I want it to be:</p>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding" xmlns:cwmp="urn:dslforum-org:cwmp-1-0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    &lt;soap:Header&gt;
      &lt;ID soap:mustUnderstand="1"&gt;
        &lt;string&gt;00001&lt;/string&gt;
      &lt;/ID&gt;
    &lt;/soap:Header&gt;
    &lt;soap:Body&gt;
      &lt;cwmp:Inform&gt;
        &lt;DeviceId&gt;
          &lt;Manufacturer&gt;Conexant&lt;/Manufacturer&gt;
          &lt;OUI&gt;002615&lt;/OUI&gt;
          &lt;ProductClass&gt;ADSL2+ IAD&lt;/ProductClass&gt;
          &lt;SerialNumber&gt;00261559a496&lt;/SerialNumber&gt;
        &lt;/DeviceId&gt;
        &lt;Event soapenc:arrayType="cwmp:EventStruct[1]"&gt;
          &lt;EventStruct&gt;
            &lt;EventCode&gt;0 BOOTSTRAP&lt;/EventCode&gt;
            &lt;CommandKey&gt;&lt;/CommandKey&gt;
          &lt;/EventStruct&gt;
        &lt;/Event&gt;
        &lt;MaxEnvelopes&gt;0&lt;/MaxEnvelopes&gt;
        &lt;CurrentTime&gt;2013-06-07 07:16:54.128 UTC&lt;/CurrentTime&gt;
        &lt;RetryCount&gt;0&lt;/RetryCount&gt;
        &lt;ParameterList soapenc:arrayType="cwmp:ParameterValueStruct[1]"&gt;
          &lt;ParameterValueStruct&gt;
            &lt;name&gt;InternetGatewayDevice.DeviceInfo.SpecVersion&lt;/name&gt;
            &lt;value&gt;1.0&lt;/value&gt;
          &lt;/ParameterValueStruct&gt;
        &lt;/ParameterList&gt;
      &lt;/cwmp:Inform&gt;
    &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>I've investigated this problem more. And I found that Xstream handles fields in 
  wrong order on Android. Xstream handles fields well in Java project.</p>
  
  <pre><code>@XStreamAlias("cwmp:Inform")
  public class Inform {
      @XStreamAlias("DeviceId")
      private DeviceIdStruct      deviceId;
  
      @XStreamAlias("Event")
      private EventList           event;
  
      @XStreamAlias("MaxEnvelopes")
      private int                 maxEnvelopes;
  
      @XStreamAlias("CurrentTime")
      private Date                currentTime;
  
      @XStreamAlias("RetryCount")
      private int                 retryCount;
  
      @XStreamAlias("ParameterList")
      private ParameterValueList  parameterList;
  }
  </code></pre>