I use XStream to serialize the Objects to XML format. The formatted xml I get is below: node1, node2, node 3 are attributes of pojo, DetailDollars
I have a requirement when I have to calculate the percentage, for example 100/25, and add new nodes to the existing ones. So, the end result should be:
<DetailDollars> <node1>100 </node1> <node2>25</node2> <node3>10</node3> </DetailDollars>
I wrote my own converter and registered to my xstream object.
public void marshal(..){ writer.startNode("node4"); writer.setValue(getNode1()/ getnode2() ); writer.endNode(); }
But, the xml stream that I get has only a new node:
<DetailDollars> <node4>4</node4> </DetailDollars>
I'm not sure which xstream api will provide me with the desired format. could you help me with this.
source share