custom 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:31 UTC
Read the original article Hit count: 445

Filed under:
|

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 DetailDollars
node1 100 /node1 node2
25 /node2 node3 10
/node3 /DetailDollars

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 : DetailDollars node1 100 /node1 node2 25 /node2 node3 10 /node3
node4 4 /node4
DetailDollars

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: DetailDollars
node4
4
/node4 /DetailDollars

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

Related posts about xstream

Related posts about converter