csutom converter in XStream
Posted
by Raja Chandra Rangineni
on Stack Overflow
See other posts from Stack Overflow
or by Raja Chandra Rangineni
Published on 2010-03-16T18:08:13Z
Indexed on
2010/03/16
18:11 UTC
Read the original article
Hit count: 500
Hi All,
I am using XStream to serialize my Objects to XML format. The formatted xml that I get is as below: node1, node2, node 3 are attributes of pojo,DetailDollars 100 25 10
I have requirement where in I have to calucluate a percentage, for example 100/ 25 and add the new node to the existing ones. So, the final output should be : 100 25 10 4
I wrote a custom converter and registered to my xstream object.
public void marshal(..){
writer.startNode("node4");
writer.setValue(getNode1()/ getnode2() );
writer.endNode();
}
But, the xml stream I get has only the new node: 4
I am not sure which xstream api would get me the desired format. could you please help me with this .
Thanks, Raja chandra Rangineni.
© Stack Overflow or respective owner