I have a XML file like this
<?xml version="1.0" encoding="utf-8"?>
<Survey
Name="Aerosmith's Survey"
Id="S2"
UserId="Admin"
CreatedBy="Administrator"
cultureName="en-CA"
numberOfQuestions="5"
completedPercent="0"
createdTimeStamp="June 26, 2012 16:01"
lastUpdatedTimeStamp="">
<Questions>
<Question
id="q1"
name="Question #1"
type="SingleChoice"
allowBackButton="false"
isRequired="true"
numLines="0"
questionIndex="1">
<QuestionText>Who is your favourite Aerosmith's Member ?</QuestionText>
<Answers>
<Answer answerIndex="1" >Joey Kramer</Answer>
<Answer answerIndex="2" >Steven Tyler</Answer>
<Answer answerIndex="3" >Tom Hamilton</Answer>
<Answer answerIndex="4" >Joe Perry</Answer>
<Answer answerIndex="4" >Brad Whitford</Answer>
</Answers>
<Response respondedTimeStamp=""></Response>
<OnChoice></OnChoice>
</Question>
<Question
id="q2"
name="Question #2"
type="MultipleChoice"
allowBackButton="true"
isRequired="true"
numLines="0"
questionIndex="2">
<QuestionText> Which is your favourite Aerosmith Song ?</QuestionText>
<Answers>
<Answer answerIndex="1" >Dream On</Answer>
<Answer answerIndex="2" >Sweet Emotion</Answer>
<Answer answerIndex="3" >Walk this way!!</Answer>
<Answer answerIndex="4" >I Don't Want to Miss a Thing</Answer>
<Answer answerIndex="5" >Jaded</Answer>
</Answers>
<Response respondedTimeStamp=""></Response>
<OnChoice></OnChoice>
</Question>
<Question
id="q3"
name="Question #3"
type="Date"
allowBackButton="true"
isRequired="true"
numLines="0"
questionIndex="3">
<QuestionText>What is Your Date of birth?</QuestionText>
<Answers></Answers>
<Response respondedTimeStamp=""></Response>
<OnChoice></OnChoice>
</Question>
</Questions>
</Survey>
Now in my App I have used a SAX parser to read these.
Now each question has a question type as you can see in my xml.
<Question
id="q1"
name="Question #1"
type="SingleChoice"
allowBackButton="false"
isRequired="true"
numLines="0"
questionIndex="1">
based on this I have populated my Checkbox in a list view.
Now what i want to do is that suppose any user checks an item then in the tag
<Response respondedTimeStamp=""></Response>
I have to write the time stamp and the response value as text for that particular question.
So How do i do it?
You can use XStream library for writing the data to the xml.