I'm using C# (.Net framework 4 with VS 2010) for reading a dynamically generated XML file. The file is containing answers for questions (MCQ radio buttons, MCQ multi answer check boxes and simple text fields). Question IDs and option IDs are generated from database.
I just need to extract Question ID and relevent Answer ID(s). Sample XML is as follows.
<?xml version="1.0"?>
<Root>
<!-- Radio Button Answers -->
<Question_6_Option>26</Question_6_Option>
<Question_8_Option>32</Question_8_Option>
<Question_9_Option>off</Question_9_Option>
<!-- Check Box Answers -->
<Question_15_Option_41>41</Question_15_Option_41>
<Question_15_Option_42>off</Question_15_Option_42>
<Question_16_Option_43>43</Question_16_Option_43>
<!-- Text Box Answers -->
<Question_23_Text>London</Question_23_Text>
</Root>
Above XML is generated in the format,
Tag name format: Question_QuestionID_SomeLogic based on answer type (radio, multiple options or text box).
If a user unanswered for a question value will display as "off". Those no need to consider.
How can I get the Question ID and Answer value from C#?
Thanks,
Chatur