[xstream-user] Tag order

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xstream-user] Tag order

Simon-17
Hi

My class looks like this:

public class A {
 private String fieldA ="aaa";
 private String fieldB ="bbb";
 private String fieldC ="ccc"
...
}

If a serialize this class to XML the result is

  ...
  <A>
    <fieldC>ccc</fieldC>
    <fieldB>bbb</fieldB>
    <fieldA>aaa</fieldA>
  </A>
  ...

Id like to have fileds serialized in same order as they are defined in the
class def. not the reversed eg.

...
  <A>
    <fieldA>aaa</fieldA>
    <fieldB>bbb</fieldB>
    <fieldC>ccc</fieldC>
   
   
  </A>
  ...


 Am I able to do that?

Thanks in advance

  Simon