Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- true
- <rule id="1">
- <question id="123" answer="true" />
- <question id="124" answer="false" />
- <choice id="1">
- <question id="125" answer='true' />
- <choice id="2">
- <question id="126" answer='false' />
- <question id="127" answer='false' />
- </choice>
- </choice>
- </rule>
- bool IsRuleSatisfied(XmlElement rule)
- {
- bool satisfied = true;
- foreach (XmlElement child in rule.SelectNodes("*"))
- {
- if (child.Name == "question")
- {
- satisfied = satisfied && IsQuestionCorrect(child);
- }
- if (child.Name == "choice")
- {
- satisfed = satisfied && IsChoiceCorrect(child);
- }
- if (!satisfied)
- {
- return false;
- }
- }
- return true;
- }
Add Comment
Please, Sign In to add comment