title: How to compare a user's multiple answers with my XML file?
body: <p>I'm creating a web page of interviews, where the user can answer a specific question mentioned on the screen inside the textbox. I have a check button. On click of this button I need to compare the answer entered in the specific question textbox and usually display accuracy of answer in percentage by comparing with my XML file's answer for specific question.</p>
  
  <p>This is my XML file"</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; 
  &lt;Questions&gt; 
    &lt;Question id="1"&gt;What is IL code &lt;/Question&gt; 
    &lt;Answer id="1"&gt;Half compiled, Partially compiled code &lt;/Answer&gt; 
    &lt;Question id="2"&gt;What is JIT &lt;/Question&gt; 
    &lt;Answer id="2"&gt;IL code to machine language &lt;/Answer&gt; 
   &lt;Question id="3"&gt;What is CLR &lt;/Question&gt; 
    &lt;Answer id="3"&gt;Heart of the engine , GC , compilation , CAS(Code access security) , CV ( Code verification) &lt;/Answer&gt; 
  &lt;/Questions&gt;
  </code></pre>
  
  <p>This is my form:</p>
  
  <p><img src="https://i.stack.imgur.com/mpmXS.jpg" alt="enter image description here"></p>
  
  <p>Below is my code for my check button, where I have only compared with a single label and textbox. It works.</p>
  
  <pre><code>XmlDocument docQuestionList = new XmlDocument();// Set up the XmlDocument //
  docQuestionList.Load(@"C:\Users\Administrator\Desktop\questioon\questioon\QuestionAnswer.xml"); //Load the data from the file into the XmlDocument //
  XmlNodeList AnswerList = docQuestionList.SelectNodes("Questions/Question");
  foreach (XmlNode Answer in AnswerList)
  {
      if (Answer.InnerText.Trim() == Label2.Text)
      {
          string[] arrUserAnswer = TextBox1.Text.Trim().ToLower().Split(' ');
          string[] arrXMLAnswer = Answer.NextSibling.InnerText.Trim().ToLower().Split(' ');
          List&lt;string&gt; lststr1 = new List&lt;string&gt;();
          foreach (string nextStr in arrXMLAnswer)
          {
              if (Array.IndexOf(arrUserAnswer, nextStr) != -1)
              {
                  lststr1.Add(nextStr);
              }
          }
          if (lststr1.Count &gt; 0)
          {
              TextBox1.Text = ((100 * lststr1.Count) / arrXMLAnswer.Length).ToString() + "%";
          }
          else
          {
              TextBox1.Text = "0 %";
          }
      }
  }
  </code></pre>
  
  <p>As you can see, I have only compared the value for one question and respective answer, but I would prefer that this is not hard-coded. Instead, it should take the question and the respective textbox answer and compare with my XML file. How might I achieve my goal?</p>