Writing data from objects in java into a xml file

mr.twz

New Member
I have a piece of code as follows : \[code\] Person person1 = new Person(); person1.setName("abc"); person1.setAge(23); Person person2 = new Person(); person2.setName("xyz"); person2.setAge(32);\[/code\]And it needs to re represented in a xml file as :\[code\] <Person> <person1> <name>abc</name> <age>23</age> </person1> <person2> <name>abc</name> <age>23</age> </person2> </Person>\[/code\]How do I do it?
 
Back
Top