0

I have a java application and it produces xml output like: I have tried many things but no luck yet.

<remittances>
<remittance>
<financialData_priAmnt_curr>a</financialData_priAmnt_curr>
<financialData_priAmnt_val>a</financialData_priAmnt_val>
<status_dateCreated>a</status_dateCreated>
<status_errorCode>a</status_errorCode>
<status_statusCode>a</status_statusCode>
<supplementaryData_key>a</supplementaryData_key>
<supplementaryData_value>a</supplementaryData_value>
<transactionId>a</transactionId>
<transactionType>a</transactionType>
</remittance>
</remittances>

but I want show this in more formatted way. like:

  <person>
  <firstname>Joe</firstname>
  <lastname>Walnes</lastname>
  <phone>
    <code>123</code>
    <number>1234-456</number>
  </phone>
  <fax>
    <code>123</code>
    <number>9999-999</number>
  </fax>
</person>
Mehedi
  • 159
  • 3
  • 4
  • 10

1 Answers1

0

You can use annotations to change some of the names and behaviour:

@XStreamAlias("Person") -> this will change the class name to Person
@XStreamOmitField("password") -> to omit the password field.

See more info here: http://x-stream.github.io/annotations-tutorial.html

If this is not enough for you, I am afraid you will have to write your own converter to do it. Xstream allows this. http://x-stream.github.io/converter-tutorial.html

Mihai

facundofarias
  • 2,973
  • 28
  • 27
mihaisimi
  • 1,911
  • 13
  • 15