how to compare keyword inside xml node in c#

fullertoad

New Member
i having created a page of asp.net which is reading xml file node for some text.below is how my xml file looks like.\[code\]<?xml version="1.0" encoding="utf-8" ?><Questions> <Question id="1">What is IL code </Question> <Answer1>Half compiled,Partially compiled code </Answer1> <Question id="2">What is TL code </Question> <Answer2>Half compiled,Partially compiled code </Answer2></Questions>\[/code\]i have also created a .aspx page which has a label for displaying question and a text where user can enter his/her answer for that particular question and below one button has some code like below \[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() == lblQuestion.Text) { if (Answer.NextSibling.InnerText.Trim() == txtUserAnswer.Text) { // This is right Answer TextBox1.Text = "right"; } else { // This is wrong Answer TextBox1.Text = "wrong"; } } }\[/code\]i want to display percentage for the answer enterd by the user for a particular question.for example suppose question is ....What is IL code? and the user enters answer as Partially compile..so i want to only check the entered kweyword inside my xml answer node.if the user answer is matched with node answer then display the accuracy of answer in percentage.please help...thanks,
 
Back
Top