Take the 2-minute tour ×  I want to have something below to save
in the xml file  Question0 : What is ur name?  Answer0: Tina
Question0.0 : What are your hobbies?            Answer0.0.0 :
reading                 Question0.0.0.0 :What do you like in
reading.?                       Answer0.. : .....
Answer0.0.1 : Dancing                Question0.0.0.1 :which
dance do you like?     ...........same question answer as above.
There can be nested question below an answer but below a
question there can only be answers.  What will be the proper way
to write into xml suing java. I can't think of a way....? Step
by step solution to me will be great as I am new to java.
share|improve this question add comment  1 Answer  up vote 2
down vote accepted  The easiest way is probably to use JAXB.  It
consists in writing JavaBeans holding the information (in your
case, a Question and an Answer class, with the Question class
holding a list of answers, and the answer class holding a
(sub-)question).  Then, you ave